liveBook · Manning

Policy as code

Policy as code is the practice of expressing organizational, security, authorization, or compliance policies as machine-readable, version-controlled rules that can be tested and enforced automatically.

How 5 Manning books explain it

Authorization in Action

Policy as code is an approach that represents policy as machine-readable, version-controlled, and testable software artifacts.

How it is used
Uses machine-readable rules to externalize access logic and support runtime, context-aware authorization decisions.
How deep it goes
Explains policy design, repository-to-store deployment, testing, static analysis, and rollback, while deferring fuller governance treatment.
Examples
Illustrates device-security restrictions, department-based access, and separate collaboration, deployment, and global guardrail policy repositories.
What you can do after
Operate and configure an authorization policy lifecycle using repositories, automated tests, signed bundles, runtime stores, and rollback.

Read how Authorization in Action explains policy as code →

Architecting for Autonomy

Policy-as-code is a technique that represents authorization and governance policies in executable machine-readable form.

How it is used
Applies runtime governance to autonomous agent actions rather than relying only on design-time approvals.
How deep it goes
Defines executable governance rules and illustrates pre-execution evaluation, escalation, and policy-engine failure handling.
Examples
Illustrates authorization of outbound communications and a clinical policy for elective-surgery deferrals.
What you can do after
Evaluate and understand how executable rules constrain agent actions and specify escalation or fallback.

Read how Architecting for Autonomy explains policy as code →

Effective Platform Engineering

Policy-as-code is the practice of representing organizational policies as machine-readable code that can be evaluated and enforced automatically.

How it is used
Enforces governance and trust requirements at platform boundaries without taking development orchestration away from teams.
How deep it goes
Explains enforcement placements and implementation trade-offs, including admission controllers and service-mesh checks, without detailing a complete policy implementation.
Examples
Uses required Kubernetes deployment labels, signed software artifacts, and service-mesh authorization checks as operational examples.
What you can do after
Apply it via Gatekeeper or OPA to place compliance or authorization checks at deployment and service-access boundaries.

Read how Effective Platform Engineering explains policy as code →

Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

Policy as code is the practice of expressing security and compliance rules in executable or declarative form so infrastructure changes can be evaluated automatically.

How it is used
Gates infrastructure changes with automated security and compliance checks before production.
How deep it goes
Explains metadata parsing, field assertions, enforcement categories, reuse, and failure handling without detailing policy-engine internals.
Examples
Uses a Python pytest check that rejects GCP 0.0.0.0/0 database access and maps the pattern to AWS and Azure firewall resources.
What you can do after
Build and operate preproduction policy checks that diagnose insecure metadata and block noncompliant infrastructure changes.

Read how Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform explains policy as code →

Grokking Software Architecture

Policy as code is the representation and automated enforcement of operational or security rules in machine-readable code.

How it is used
Enforces security boundaries automatically in CI/CD before infrastructure changes reach production.
How deep it goes
Connects policy-as-code and infrastructure scanning to build failures and policy unit tests, but gives no policy syntax.
Examples
Uses a Terraform route between vendor and Point of Sale subnets as a rejected change, then tests guardrails with a mock attacker.
What you can do after
Apply it via Open Policy Agent and infrastructure-as-code scanners to reject unsafe Terraform network routes before deployment.

Read how Grokking Software Architecture explains policy as code →

Also covered in

What to know first

Related concepts

Questions about policy as code

What is policy as code?

Policy as code is the practice of expressing organizational, security, authorization, or compliance policies as machine-readable, version-controlled rules that can be tested and enforced automatically.

Which Manning books explain policy as code?

Authorization in Action, Architecting for Autonomy, Effective Platform Engineering, Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform and Grokking Software Architecture.

What should I know before learning policy as code?

Manning books that teach policy as code usually introduce auditability, compliance, AI agent and anomaly detection first.

What is the difference between policy as code and policy as data?

Policy as code is the practice of expressing organizational, security, authorization, or compliance policies as machine-readable, version-controlled rules that can be tested and enforced automatically. An authorization approach that stores specific attributes, permissions, or relationships as structured data for a general-purpose engine to evaluate at runtime.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.