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 identity, service-account status, roles, and groups
input.costsInfracost resources reported for the run, or an empty array when no cost data is available
input.violationsVulnerability and misconfiguration findings reported for the run, or an empty array when none are available

The input.actor object contains:

Field
Type
Description
idstringUser ID
namestringUser display name
emailstringUser email address
service_accountbooleanWhether the actor is a service account
roles.adminbooleanWhether the actor is a Plural administrator
groupsstring arrayNames of the groups the actor belongs to

Each entry in input.plan.resource_changes contains:

Field
Description
addressFull Terraform resource address
typeTerraform resource type, such as aws_eks_cluster
nameResource name
provider_nameShort 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

Cost data