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 →
- Run tests in a dedicated sandbox account with budgets and alarms.
- Tag everything with
test-run-idandttl. - Run a nightly sweeper (
cloud-nukeor a custom script) deleting expired items. - Always run
destroyin adefer/always()step.
Why → Failures are normal; cleanup must not depend on tests succeeding.
Interview tip → Account-level isolation limits blast radius.
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`.IntermediateHow 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?AdvancedA stack is still on Terraform 0.12 syntax and old providers. What upgrade path do you follow?Advanced