One Terraform template — an S3 bucket whose ACL you control — is pushed through two pipelines side by side. The undefended pipeline (orange lane) has no gate: it applies the template to dev, staging and prod simultaneously, whatever it contains. The policy-gated pipeline (cyan lane) scans the plan against a baseline rule set first; a violation blocks the deploy entirely, before a single environment is touched.
rule IAM-S3-001: deny s3_bucket.acl in {"public-read","public-read-write"}
on plan:
if template.acl violates any rule:
gated -> BLOCK (0 environments touched)
undefended -> APPLY to dev, staging, prod (all 3 exposed)
else:
both pipelines -> APPLY (0 environments exposed)
- Bucket ACL — toggles the template between a compliant
private setting and a violating public-read setting.
- Pipeline mode — which lane "Run pipeline" fires; the gate only exists on the policy-gated lane.
- Run pipeline — deploys through the selected lane only.
- Compare both — fires both lanes at once with the same template, so the exposure counter updates side by side.
Real-world relevance: this is the core value proposition of policy-as-code tools (OPA/Conftest, Sentinel, Checkov) wired into a CI/CD gate — catching an infrastructure misconfiguration at plan-time, before apply ever reaches a real cloud account, instead of relying on someone noticing after the fact.