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

Real-cloud integration tests leave orphaned resources when they fail midway. How do you handle that?

AdvancedScenarioTesting Upgrades and Large-Scale Operations
Answer

Situation read → Cost leak and quota exhaustion in the test account.

What I'd do →

  1. Run tests in a dedicated sandbox account with budgets and alarms.
  2. Tag everything with test-run-id and ttl.
  3. Run a nightly sweeper (cloud-nuke or a custom script) deleting expired items.
  4. Always run destroy in a defer/always() step.

Why → Failures are normal; cleanup must not depend on tests succeeding.

Interview tip → Account-level isolation limits blast radius.

All Terraform questions Roadmap: Terraform in production

More on Testing Upgrades and Large-Scale Operations