Interview Prep/Terraform/Testing and Policy as Code

Preconditions or external policy: which to use?

IntermediateProductionTesting and Policy as Code
Answer

precondition and validation live with the code, run everywhere (including laptops and tests) and express module-specific assumptions. External policy (OPA, Sentinel, Checkov) expresses organization-wide rules that apply across all repos and cannot be removed by the module author. We use both: module invariants in-code, company rules outside.

All Terraform questions Roadmap: Terraform in production

More on Testing and Policy as Code