Back to all blog posts
Guides

Introducing the Terramate GitHub Action

Integrating Terramate into your GitHub Actions workflows just got easier with the introduction of the Terramate Action on the GitHub Marketplace.

Photo of Annu Singh
Annu Singh
· 2 min read
Terramate Action

Introducing the Terramate GitHub Action

Simplifying Terramate Integration with GitHub Actions

Integrating Terramate into your GitHub Actions workflows just got easier with the introduction of the Terramate Action on the GitHub Marketplace. Say goodbye to the hassle of manual installations and hello to efficient infrastructure management.

Key Features at a Glance

The Terramate GitHub Action, terramate.io/terramate-action , offers several key features designed to enhance your workflow:

  • Version Flexibility: Download a specific version of Terramate CLI or let it intelligently fall back to an asdf -configured version or the latest release.
  • Installation Control: Install Terramate CLI in a location of your choice, with the default being /usr/local/bin .
  • Wrapper Benefits: By default, Terramate installs a wrapper script that enables calls to the Terramate binary, exposing GitHub Action outputs such as stderr , stdout , and the exitcode of terramate execution for seamless functionality.
  • Terramate Cloud Integration: Seamlessly configure your default Terramate Cloud organization to leverage powerful features like Drift Detection and Stack Health Information.

Compatible with Ubuntu Runners

As of now, the action is compatible with Ubuntu runners. If you need support for additional runners, simply raise an issue on our GitHub repository , and we'll work on expanding compatibility.

Usage Guide

Getting started with the Terramate Action is straightforward. Here's how you can use it in your workflows:

Install the Latest Version (default behavior, falls back to asdf config):

The default action installs Terramate CLI in its latest version unless a specific version is configured by the asdf config file( .tool-versions ) :

steps:
  - uses: terramate-io/terramate-action@v1

To disable asdf integration and install the latest version explicitly, use:

steps:
  - uses: terramate-io/terramate-action@v1
    with:
      version: "latest"

Install a Specific Version:

Install a specific version of Terramate CLI:

steps:
  - uses: terramate-io/terramate-action@v1
    with:
      version: "0.4.2"

Customize Installation Path (default: /usr/local/bin ):

Change the installation location using the bindir argument:

steps:
  - uses: terramate-io/terramate-action@v1
    with:
      bindir: /usr/local/bin

Configure Terramate Cloud Organization:

Set the default Terramate Cloud Organization by specifying the cloud_organization argument:

steps:
  - uses: terramate-io/terramate-action@v1
    with:
      cloud_organization: myorganization

Disable Wrapper Script:

To disable the optional wrapper script, set use_wrapper to "false":

steps:
  - uses: terramate-io/terramate-action@v1
    with:
      use_wrapper: "false"

Subsequent steps can access outputs when the wrapper script is installed:

steps:
  - uses: terramate-io/terramate-action@v1

  - id: list
    run: terramate list --changed

  - run: echo ${{ steps.list.outputs.stdout }}
  - run: echo ${{ steps.list.outputs.stderr }}
  - run: echo ${{ steps.list.outputs.exitcode }}

Pipeline Example

To make it easy to understand, we have an example workflow that shows how to utilize the Terramate GitHub Action comprehensively. This example can help you better understand its usage.

Enhance Your GitHub Actions with Terramate

Enhance your CI/CD pipelines with Terramate's powerful capabilities. Try the Terramate Action today for smooth integration and advanced infrastructure insights.

Join the Community

We’re committed to continually improving Terramate to meet your evolving needs. Dive into the Terramate community and connect with like-minded individuals who share your passion for infrastructure management. Whether you’re a seasoned pro or just getting started, our community is here to support you every step of the way. Join us on Discord   and be part of the conversation!

Annu is a Developer Advocate at Terramate. He has a software engineering and technical writing background, working primarily with Go to contribute to open-source projects in the cloud-native domain. Despite working at Terramate, Annu is also a community manager at @Dapr.io.