How do you control the cost and cleanliness of integration tests?
IntermediateProductionTesting and Policy as Code
Answer
Run them in a dedicated sandbox account with budgets and SCPs, use unique name suffixes per run, run on merge or nightly rather than per commit, always defer Destroy, and run a janitor (cloud-nuke or aws-nuke) for leaked resources. Use small instance sizes and skip slow resources (NAT gateways, RDS Multi-AZ) in test configs.
More on Testing and Policy as Code
How do you test infrastructure code, and what does the testing pyramid look like?BeginnerWhat does the static-analysis layer catch?BeginnerWhat does tflint do, and how is it configured?BeginnerHow do Checkov and Trivy differ?IntermediateHow does `terraform test` work?BeginnerHow do mock providers work in `terraform test`?Advanced