Course contentsShow
← Cloud and Infrastructure
Lesson 2889 of 2,98963. Infrastructure TestingFree lesson

Policy Evaluation Workflows

Learning when and where policies are evaluated: plan-time, deployment-time, and runtime enforcement points.

Policy Evaluation Workflows

What you'll learn: You'll discover the three critical enforcement points where policy-as-code rules are evaluated—plan-time, deployment-time, and runtime—and why choosing the right moment matters for security and compliance.

When Policies Strike

Imagine a bouncer checking your credentials at three different checkpoints: before you enter the venue (plan-time), at the door itself (deployment-time), and while you're inside (runtime). Policy evaluation workflows work the same way, catching violations at different stages of your infrastructure lifecycle.

The Three Enforcement Points

Plan-Time Evaluation

Before infrastructure changes are applied, policies evaluate the proposed configuration. Tools like Open Policy Agent can analyze Terraform plans, blocking non-compliant resources before they're even attempted. This is your cheapest catch—no resources are created, no costs incurred.

Example: Catching an S3 bucket without encryption in the Terraform plan.

Deployment-Time Evaluation

During the actual provisioning process, policies verify configurations as resources are being created. This catches issues that might slip through planning or configurations generated dynamically. Cloud provider policy services often operate here.

Example: Preventing an IAM role from being created with overly permissive policies.

Runtime Evaluation

Continuous monitoring of existing resources ensures they remain compliant over time. This catches configuration drift, manual changes, or new policy rules applied to old infrastructure.

Example: Detecting an EC2 security group that someone manually modified to allow unrestricted SSH access.

Why Multiple Layers?

Each evaluation point serves a purpose. Plan-time is fast and preventive. Deployment-time catches dynamic issues. Runtime provides ongoing assurance. Together, they create defense-in-depth for your infrastructure governance.

Key Takeaway: Policy evaluation happens at three stages—plan-time (cheapest, preventive), deployment-time (catches dynamic issues), and runtime (continuous compliance)—with each layer catching what earlier stages might miss.