NEWPractise supported commands in browser simulations, alongside the lesson.Try a browser practice exercise.Try a lab♥ Codelivly is 100% free, no paywall. If it helped you, chip in to keep it running.100% free. Help keep it so.Support us
Preview · 30 min
Master blocking non-compliant Terraform plans in CI. Learn to generate plan JSON, write Conftest Rego policies, and enforce automated security gates.
In the previous lessons, you learned how to write Rego policies and evaluate them locally against sample JSON data. However, a policy that only runs on a developer's laptop provides zero organizational value. The true power of Policy as Code is realized when it is integrated directly into the CI/CD pipeline, acting as an automated, deterministic gatekeeper that prevents non-compliant infrastructure from ever being deployed.
In this guided lab, you will act as a Platform Engineer tasked with implementing a cross-resource validation policy. You will author a Rego policy that ensures every new S3 bucket created in a Terraform plan has a corresponding public access block. You will generate a Terraform plan, convert it to JSON, execute Conftest to catch the violation, and finally remediate the code to prove the policy works. This exercise bridges the gap between writing theoretical policies and enforcing them in a production-grade CI/CD environment.
Create a free account to unlock the rest of this task, complete tasks, and earn Rep.
Sign in