Policy Packs

Policy packs enable administrators to apply one or more policies across multiple accounts and/or resources, automating what would otherwise be a time-consuming manual process of creating individual policy settings on each resource. You create a policy pack, add the policy settings you want to enforce, then attach the pack to one or more resources in the hierarchy. The policies the pack defines govern all resources below the attachment point.

Policy packs are the recommended way to manage policy settings in Guardrails. Compared to direct settings on individual resources, packs are reusable, auditable, easy to version-control with Terraform, and straightforward to remove when no longer needed.

Guides

GuideDescription
Create a Policy PackCreate a new policy pack with a title and description, then add policy settings.
Attach a Policy PackAttach a policy pack to a resource so its settings take effect.
Detach a Policy PackRemove a policy pack from a resource.
Modify a Policy PackAdd settings, edit the title and description, or delete a policy pack.
Policy Packs as CodeCreate and manage policy packs with Terraform, and contribute to the Guardrails Hub.

How Policy Pack Ordering Works

The order of policy pack attachments matters. Guardrails resolves policies by starting at the resource and ascending the resource hierarchy towards the root. The closest policy setting to the resource wins.

When multiple policy packs set the same policy type at the same level in the hierarchy, the pack attached later takes priority over packs attached earlier. If no policies are set in any pack or direct setting, Guardrails uses the default policy value from the mod.

For example, if you attach "Enterprise Checks" (which sets AWS > S3 > Bucket > Versioning to Check: Enabled) and then attach "Retail Banking Enforcements" (which sets the same policy to Enforce: Enabled), the enforcement pack wins because it was attached later, closer to the resource in the resolution order.

[!NOTE] Policy pack attachments and detachments are heavy database operations when the policy pack is attached to many resources or contains many policies (or both). Be mindful when making large policy or attachment changes. Consider breaking them into smaller batches to reduce the impact on your workspace.

Creating Policy Packs as Code

While policy packs can be created and managed in the Guardrails console, the most scalable approach is to manage them as code with Terraform. This gives you version control, peer review, and repeatable deployments. The guardrails-samples repository contains hundreds of ready-to-use policy pack examples covering AWS, Azure, and GCP.

See Policy Packs as Code for a full Terraform walkthrough.

Further Reading