Terraform logo
Infrastructure as code

Terraform

Declarative infrastructure as code for any cloud. Terraform, from HashiCorp, is a tool for describing infrastructure in declarative configuration files (HCL) and applying the changes through provider APIs. It keeps a state file of what it manages and shows a plan before making changes. Providers exist for every major cloud and many SaaS products; OpenTofu is a community fork with a compatible workflow.

When it is the right choice

  • You want every cloud resource defined, reviewed and versioned in Git
  • You manage several environments or clouds with the same patterns
  • You need a plan of every change before it is applied
  • Note that Terraform moved to the Business Source Licence in 2023; check whether it affects you or consider OpenTofu

How we use it

  • Write modular Terraform with remote state, locking and separate environments
  • Run plan on every pull request and apply only from the pipeline after review
  • Use AI to draft changes and explain plans, with a human approving every apply
  • Detect drift on a schedule and bring manual changes back into code
Works well with

Often used together

Questions

Terraform: frequently asked

Terraform or OpenTofu?

Both use the same language and workflow. OpenTofu is open source under the Linux Foundation; Terraform has HashiCorp's licence and commercial products. We work with either.

How do we bring existing resources under Terraform?

Terraform can import existing resources into state. We do it in stages, checking that each plan shows no unwanted changes.

Running Terraform, or deciding whether to? Tell us what you have; the first consultation is free.

Let's talk »