← Terraform & Infrastructure as Code learning path
Terraform & Infrastructure as Code · Module 8 of 10

Terraform in CI/CD

Automate plan and apply safely.

📖 Key ideas

  1. Run fmt, validate and plan on every pull request.
  2. Post the plan for reviewers to read.
  3. Apply only after approval on the main branch.
  4. Authenticate with short-lived credentials (OIDC).
  5. Tools: GitHub Actions, Atlantis, Terraform Cloud/HCP Terraform.
💡 Real-life example: Automated Terraform is a two-key safe: the plan is shown, a reviewer turns the second key to apply.
Plan in PRShow changes for review
AtlantisPull request automation for Terraform
OIDCShort-lived identity federation
HCP TerraformHashiCorp's managed Terraform service