Learn CI/CD Automation with Terraform and CircleCI
Integrating new software into established workflows can be challenging. Continuous integration and delivery (CI/CD) platforms like CircleCI provide automated, structured pipelines for new releases. Infrastructure management, typically handled by operations teams, can also fit into an automated release workflow using infrastructure as code with Terraform.
To help you get started with CI/CD automation, we've published a new tutorial that walks you through deploying new infrastructure using Terraform, automatically triggered by CircleCI.
» Why Terraform?
CircleCI is a continuous integration tool for automation of software builds, tests, and deployments. The continuous integration workflow allows development teams to automate, self-test, quickly build, clone, and deploy software. Terraform allows for repeatable infrastructure deployment, so by adding Terraform to a CircleCI workflow, you can deploy your infrastructure alongside software in the same pipeline.
Terraform Cloud allows for remote state and automated runs from CircleCI, so your infrastructure can be deployed in the same way.
» What you'll learn
In this track, you will create the underlying infrastructure for a static website with Terraform, and deploy a webapp with CircleCI in the same workflow.
» CI/CD + Terraform = Dev/Ops
Whether you are a developer responsible for software deployment or a sysadmin building underlying systems, you will be able to use your skills to deploy infrastructure as code, resulting in a working application to test.
You will start by learning how to use your CircleCI workflow in a standard deployment cycle.
workflows:
version: 2
build_plan_approve_apply:
jobs:
- build
- plan:
requires:
- build
- apply:
requires:
- plan
- deployment:
requires:
- apply
- hold:
type: approval
requires:
- deployment
- destroy:
requires:
- hold
You will also create a Terraform Cloud workspace and learn how to integrate your infrastructure into your CircleCI build settings.
» Deploy and destroy
By the end of the guide, you will have a successful deployment and a safe destruction process.
» Try the new guide with demo code
To run through a live deployment with an accompanying code repo, visit HashiCorp Learn.
If you would like to learn more about CircleCI or automated Terraform workflow best practices, consider these resources:
Sign up for the latest HashiCorp news
More blog posts like this one
![Simplify policy adoption in Terraform with pre-written Sentinel policies for AWS](/_next/image?url=https%3A%2F%2Fwww.datocms-assets.com%2F2885%2F1620155432-blog-library-product-terraform-aws-logomarks-dark.jpg&w=3840&q=75)
Simplify policy adoption in Terraform with pre-written Sentinel policies for AWS
The new pre-written policy library co-developed by HashiCorp and AWS is now generally available, aiming to reduce the barrier of adoption for policy as code infrastructure workflows.
![Terraform provides more flexible controls with project-owned variable sets](/_next/image?url=https%3A%2F%2Fwww.datocms-assets.com%2F2885%2F1714170900-blog-library-product-hcp-terraform-dark.jpg&w=3840&q=75)
Terraform provides more flexible controls with project-owned variable sets
Project-owned variable sets simplify management, reduce dependencies, and allow for more flexible control over access and usage.
![A smoother HCP Terraform workspace experience](/_next/image?url=https%3A%2F%2Fwww.datocms-assets.com%2F2885%2F1714170900-blog-library-product-hcp-terraform-dark.jpg&w=3840&q=75)
A smoother HCP Terraform workspace experience
Learn how to automate HCP Terraform workspace setup and onboarding with the TFE provider, a custom module, and good requirements gathering.