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.
More on CI/CD and Automation
Why run Terraform from a pipeline instead of laptops?BeginnerWhat stages does a good Terraform pull-request pipeline have?BeginnerHow do you serialize applies to the same stack in CI?AdvancedShow a minimal GitHub Actions workflow for plan on PR.BeginnerHow does OIDC authentication from GitHub Actions to AWS work?IntermediateWhat is Atlantis and how does the flow work?Beginner