Interview Prep/Terraform/CI/CD and Automation

How do you make sure the apply runs exactly what was reviewed?

IntermediateProductionCI/CD and Automation
Answer

Save the plan in the plan job (terraform plan -out=tfplan), upload it as a protected artifact and apply that file in the apply job after approval. Terraform rejects a stale plan if state changed. For the plan file to be valid, apply must use the same code, same providers and the same working directory layout, so run both in one workflow with the same checkout SHA.

All Terraform questions Roadmap: Terraform in production

More on CI/CD and Automation