Terraform Advanced — Terraform Cloud Runs

less than 1 minute read

Let HashiCorp manage your Terraform CI/CD with Terraform Cloud.


VCS-Driven Workflow

# Configure backend
terraform {
  cloud {
    organization = "my-org"
    workspaces {
      name = "prod-networking"
    }
  }
}
Push to branch → Terraform Cloud auto-plans
Merge to main  → Plan runs, then wait for manual confirm to apply

Run Triggers

Chain workspace applies:

networking workspace applies → triggers app workspace plan

Useful for dependency ordering: networking must be applied before app.


Workspace Variables

Set via UI, CLI, or API:

# Terraform variables
terraform cloud variable set \
  --workspace prod-networking \
  --key vpc_cidr \
  --value "10.0.0.0/16"

# Environment variables (AWS creds)
terraform cloud variable set \
  --workspace prod-networking \
  --key AWS_ACCESS_KEY_ID \
  --value "AKIA..." \
  --category env \
  --sensitive

Comparison

Feature GitHub Actions Atlantis Terraform Cloud
Hosting GitHub-managed Self-hosted HashiCorp-managed
State Self-managed Self-managed Built-in
Cost Free (public repos) Free (open source) Free tier + paid
Policy OPA/Checkov OPA/Checkov Sentinel
Approval PR reviews PR comments UI confirm

What’s Next?

Practice CI/CD patterns.

← Atlantis Practice Exercises →

Updated: