Gate agent-written Terraform with policy checks on the plan JSON instead of trusting the agent's own review
Summary A freeCodeCamp handbook (Kayode Adeniyi, 29 Sep 2026) shows a policy-as-code gate for AI-generated infrastructure: terraform show -json, OPA/Rego policies written test-first, and a script that fails the run on any deny, plus Kubernetes admission policies. The same gate can block destroys before apply. Start with terraform show -json tfplan.binary > plan.json