Someone ran `terraform destroy` against production. What's your recovery plan?
AdvancedScenarioTesting Upgrades and Large-Scale Operations
Answer
Situation read → Worst-case incident.
What I'd do →
- Stop further changes and revoke the identity's access.
- Check what survived: deletion protection and
prevent_destroymay have saved databases. - Restore stateful data from snapshots and backups first (RDS, EBS, S3 versions).
- Re-apply the code (state is empty or reflects destroyed items) to recreate stateless layers.
- Run a blameless review: remove human prod credentials, require approval, enable protection.
Why → Data recovery comes first; infrastructure is reproducible from code.
Interview tip → This is why DR drills and deletion protection exist.
More on Testing Upgrades and Large-Scale Operations
What does each of `terraform validate`, `plan` and `terraform test` actually check?BeginnerWrite a native test for a module that creates an encrypted S3 bucket.IntermediateCompare Terratest with `terraform test`.IntermediateReal-cloud integration tests leave orphaned resources when they fail midway. How do you handle that?AdvancedHow do you upgrade from Terraform 1.5 to 1.9 safely?IntermediateMajor AWS provider upgrade from v4 to v5 (or v5 to v6) across many stacks. How do you plan it?Advanced