Chapter 02 Quiz: Infrastructure as Code (IaC)
Questions
Why is
plan -> review -> applysafer than directapply?What risk does Terraform state locking prevent?
In this repo, what is the purpose of
scripts/guard-terraform-plan.sh?You have a valid planfile but it is 4 hours old. What should you do and why?
What is drift, and why should you address drift before unrelated infrastructure changes?
Name two signals in a plan output that should trigger a stop-and-review decision.
Why is least-privilege IAM/RBAC relevant to Terraform automation?
What must be verified before running a destroy workflow in any environment?
Why should drift findings be documented in PR notes before apply?
Which local checks should pass before Terraform changes are merged?
Answer Key (Short Form)
- It creates a review checkpoint and prevents unintended changes from being applied blindly.
- Concurrent state mutation and corruption from overlapping apply operations.
- It enforces guardrails so apply happens only from reviewed, fresh plan artifacts.
- Regenerate and re-review the plan because infrastructure and dependencies may have changed.
- Drift is mismatch between declared and real infrastructure; ignoring it compounds risk.
- Unexpected deletes, changes in unrelated modules/resources, environment mismatch indicators.
- It limits blast radius and prevents broad credentials from making uncontrolled changes.
- Exact environment scope, expected impact, and rollback/recreate path.
- To keep risk visible, improve review quality, and avoid silent infrastructure divergence.
terraform fmt,terraform validate, security checks, and Flux render validation when manifests are touched.