policy as code
Writing organisational rules, such as required tags or allowed regions, as code that automatically checks every proposed change.
In more detail
Rules kept as code can be reviewed, versioned and tested like any other code, and a pipeline can enforce them on every change instead of relying on people to remember. Open Policy Agent and HashiCorp Sentinel are common engines.
Examples
The course keeps accepted builders, required checks, scanner gates and exception expiry in policy code reviewed like any production change.In Terraform: In a Terraform pipeline the policy engine reads the plan as JSON and rejects changes that break a rule, before anyone applies them. Open Policy Agent and HashiCorp Sentinel are common engines.Related terms
- security gate — An automated check in a pipeline that stops a change going further when it fails, usually by exiting with a non-zero code.
- builder identity — The recorded identity of the system that built an artefact, such as a named continuous integration pool.
- infrastructure as code — Describing servers, networks and other infrastructure in text files that a tool reads to create and change the real thing.
- tag policy — A rule listing which tags resources must have and which values are allowed, checked before or after deployment.
- guardrail — A control that blocks a dangerous action whatever else is allowed, such as an explicit deny or a block on public access.
- Open Policy Agent — A general-purpose policy engine that evaluates Rego policies against JSON input and returns a JSON decision.
- Rego — The policy language of Open Policy Agent, in which rules are sets of conditions over JSON input.
- JSON plan representation — The machine-readable form of a saved plan, produced by terraform show -json, which lists every planned change and value.
- release gate — An automatic check that must pass before a change may be deployed.
Taught in
- Friday At Five To Five: DevOps And DevSecOps — Certified GitOps Associate (CGOA) Exam Prep
- Managed Relational Databases (RDS) — Cloud Infrastructure & Hyperscaler Architecture
- Policy-as-Code Architecture: OPA & Rego Syntax — Cloud Security & DevSecOps Engineering
- Provenance And Signing — Application Security & Threat Modeling for Engineers
- How To Stop Drowning In Findings — Application Security & Threat Modeling for Engineers
- Running Terraform In CI — Infrastructure as Code with Terraform
- Native Testing With Tftest Files — Infrastructure as Code with Terraform
- Provider Mocking For Tests — Infrastructure as Code with Terraform
- Policy As Code With OPA — Infrastructure as Code with Terraform
- Releasing The Real Cloud Artifact — Infrastructure as Code with Terraform
- Runs In HCP Terraform: The cloud Block And Remote Execution — HashiCorp Terraform Associate (004) Exam Prep
- Collaboration And Governance: Teams, Policies, Registry And Health — HashiCorp Terraform Associate (004) Exam Prep
References
- Open Policy Agent: introduction
- What is AWS CloudFormation Guard?
- Open Policy Agent: philosophy
- Sentinel: policy as code