NEW350+ rooms now have a live terminal, so you can learn by typing the commands, right in your browser.Learn in a live terminal. 350+ rooms.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
This module transitions you from relying on predefined scanner rules to writing custom, dynamic security policies using Open Policy Agent (OPA) and its declarative query language, Rego. You will learn how to evaluate Terraform plans, Kubernetes manifests, and CI/CD pipeline configurations against strict organizational compliance rules. We will cover Rego syntax, policy testing with Conftest, integrating OPA into CI/CD pipelines for automated gating, and handling policy violations gracefully. The module culminates in a hands-on guided lab where you will author, test, and enforce a custom OPA policy to block non-compliant infrastructure deployments before they reach production.
Each task’s Rep is set individually — advanced tasks average +50. The +0 room bonus unlocks at 100%.
Frequently Asked Questions
What is policy as code?
Policy as code defines rules in a machine-readable language so they can be versioned, tested and enforced automatically. It replaces manual reviews with consistent checks across infrastructure, pipelines and applications.
What is Open Policy Agent used for?
Open Policy Agent is a general-purpose policy engine. Teams use it to make allow or deny decisions for Kubernetes admission, Terraform plans, API authorization and CI/CD gates, using policies written in Rego.
Is there a free way to practice Rego?
Yes. The Policy as Code with OPA room on Codelivly is free and hands-on, taking you through writing Rego rules, testing them and applying custom organizational policies to real configurations.