What does a contract test for a module look like?
AdvancedProductionTesting and Policy as Code
Answer
In tests/, one run block per documented behaviour: required inputs produce expected outputs, toggles create or skip resources, invalid inputs fail validation with expect_failures, and override_ or mock providers make it fast. Add one command = apply test against real AWS that checks outputs. Consumers can then upgrade confidently, because every promised behaviour has a test.
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