What is policy as code and where does it run?
BeginnerProductionTesting and Policy as Code
Answer
Rules about what infrastructure is allowed (encryption, regions, instance types, tags) written as code and evaluated automatically. They run at several points: pre-commit for speed, in CI on the plan JSON, in HCP Terraform between plan and apply (Sentinel or OPA), and in the cloud through SCPs and Config.
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