Interview Prep/Terraform/Testing Upgrades and Large-Scale Operations

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 →

  1. Stop further changes and revoke the identity's access.
  2. Check what survived: deletion protection and prevent_destroy may have saved databases.
  3. Restore stateful data from snapshots and backups first (RDS, EBS, S3 versions).
  4. Re-apply the code (state is empty or reflects destroyed items) to recreate stateless layers.
  5. 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.

All Terraform questions Roadmap: Terraform in production

More on Testing Upgrades and Large-Scale Operations