HashiCorp releases a new CI/CD pipeline integration tool and templates for Terraform Cloud
New CI/CD pipeline templates for GitHub Actions and GitLab CI provide prescriptive guides for integrating with Terraform Cloud, and a new integration tool can help build workflows with other CI/CD platforms.
HashiCorp is excited to announce the release of pipeline templates for Terraform Cloud and Terraform Enterprise. These templates come with a command line tool for prescriptively setting up and running a Terraform Cloud workflow within a CI/CD pipeline, reducing friction that can often occur in highly customized pipelines. The templates also provide prescriptive examples for other CI/CD platforms on how to integrate with Terraform Cloud.
This post introduces two new pipeline templates and offers some background on how these integrations work and the customer feedback that led to them.
» The need for a prescriptive approach to using Terraform with CI/CD
One request we often get from Terraform Cloud users is for prescriptive guidance on how to use Terraform Cloud in their CI/CD pipelines. In addition, we know that many of our partners who offer CI/CD platforms want to provide their users with prescriptive Terraform Cloud integration workflows from their side as well. While Terraform Cloud’s VCS workflows are the initial solution we recommend, many customers have existing CI/CD tooling in place and want to integrate Terraform Cloud into their custom pipelines.
For tricky integrations, users typically embed Terraform Cloud as a job within CI/CD workflows and use the CLI workflow within a CI/CD tool to execute plans and applies. This approach is simple to implement but does not provide all the capabilities of Terraform Cloud, such as saving cloud runs and a bi-directional link back from Terraform Cloud to the code. These features are available only via API workflows, but those workflows are also more complex to set up.
Terraform Cloud APIs represent the actions that are part of a run from Terraform Cloud’s perspective, such as packaging and uploading code, starting runs, and applying changes. These common actions are automatically executed as part of the CLI or VCS workflow, so they are harder to implement without more detailed knowledge of the Terraform Cloud APIs
» How the application and templates work
To reduce the friction of this integration process, we created a new CLI tool called tfci
. It’s a Go application inside a Docker container that automates Terraform Cloud runs via API and supports common Terraform Cloud operations that can be embedded into any CI tool. This allows users to onboard Terraform Cloud into more complex CI/CD pipelines.
Along with tfci
, we created a pair of initial pipeline templates that act as blueprints for integrating tfci
into CI/CD platforms:
GitHub Actions and GitLab CI are the two most common platforms for which users requested prescriptive workflows. Our intention is for third parties to participate and also add additional workflows and CI/CD platforms over time. Note that tfci
can still be used to integrate Terraform Cloud into any CI/CD platform. Pipeline templates simply make the process faster and easier. Also note that tfci
works with current versions of Terraform Enterprise since it uses the same APIs.
» Final notes and next steps
HashiCorp has published tfci
on our tfc-workflows-tooling GitHub repository. The CI/CD pipeline templates are located in these two repositories:
If you want a hands-on guide for setting up tfci
-powered GitHub Actions workflows, follow our updated Automate Terraform with GitHub Actions tutorial.
In each repository you can find documentation and open pull requests or issues. If you have an idea or want to see something new, please let us know by getting in touch through these GitHub repos.
Sign up for the latest HashiCorp news
More blog posts like this one
Fix the developers vs. security conflict by shifting further left
Resolve the friction between dev and security teams with platform-led workflows that make cloud security seamless and scalable.
HashiCorp at AWS re:Invent: Your blueprint to cloud success
If you’re attending AWS re:Invent in Las Vegas, Dec. 2 - Dec. 6th, visit us for breakout sessions, expert talks, and product demos to learn how to take a unified approach to Infrastructure and Security Lifecycle Management.
Speed up app delivery with automated cancellation of plan-only Terraform runs
Automatic cancellation of plan-only runs allows customers to easily cancel any unfinished runs for outdated commits to speed up application delivery.