Get startedSign in

Stack policies

Enforce and automate infrastructure stack approvals with Rego

Stack policies evaluate infrastructure plans before an approval-gated stack run proceeds. They can reject a run that violates a guardrail, automatically approve a known-safe plan, or leave the run undecided so it continues to the configured human or AI approval flow.

Stack policies use the plrl.stack Rego package.

Supported input

Plural evaluates a stack policy with the following top-level input:

Field
Description
input.planA reduced Terraform plan containing terraform_version and resource_changes
input.run_typeThe run operation: plan, apply, or destroy
input.stackStack metadata, including its name, project, and Git configuration
input.commitMetadata for the commit associated with the run
input.actorThe initiating user, including id, name, email, and groups when available

Each entry in input.plan.resource_changes contains:

Field
Description
addressFull Terraform resource address
typeTerraform resource type, such as aws_eks_cluster
nameResource name
providerShort provider name
change.actionsPlanned actions, such as create, update, delete, or replace
change.beforeResource state before the run
change.afterExpected resource state after the run

Decisions

A stack policy can produce:

  • deny[{"msg": "..."}]: reject the stack run
  • approve[{"reason": "..."}]: approve the stack run
  • defer: leave the decision to the next configured approval step