# Compliance as Code

> Master compliance as code using Open Policy Agent (OPA) and Rego. Learn to automate policy enforcement, test infrastructure configurations, and integrate compliance into CI/CD.

Canonical: https://codelivly.com/rooms/compliance-as-code
Last updated: 2026-10-31

| | |
|---|---|
| Level | Intermediate |
| Category | Cybersecurity |
| Lessons | 5 |
| Estimated time | 2 h 30 min |
| XP | 1360 |

This module transitions learners from theoretical continuous compliance to practical implementation using industry-standard tools. You will master the Open Policy Agent (OPA) architecture and the Rego policy language. You will learn how to write, test, and version-control compliance policies, and integrate them directly into CI/CD pipelines using tools like Conftest. The module culminates in a hands-on guided lab where you will author Rego policies to validate infrastructure-as-code (Terraform) configurations, ensuring that non-compliant resources are blocked before deployment.

## Lessons

1. What Is Compliance as Code and Why Does It Matter (30 min)
2. CIS Benchmarks and Control Frameworks (SOC 2, PCI DSS) (30 min)
3. Automated Audits with Chef InSpec (30 min)
4. Continuous Compliance Evidence Collection (30 min)
5. Guided Lab: Automating a CIS Benchmark Audit (30 min)

## Related

- [Learning path: Security Monitoring and Compliance Automation](https://codelivly.com/learning-paths/security-monitoring-and-compliance-automation)
- [All rooms](https://codelivly.com/rooms)
