Introducing the pulumi policy analyze Command for Existing Stacks
Blog post from Pulumi
Pulumi's new `pulumi policy analyze` command enables users to run policy packs against existing stack states without executing the Pulumi program or making provider calls, allowing for quick and repeatable policy validation. This command addresses the iterative process involved in policy authoring and updates by offering a lightweight alternative to the heavier `pulumi preview` or `pulumi up` commands, making it easier to validate policy logic against known states. Users can specify a policy pack path and an optional stack, and the command will exit non-zero if mandatory policy violations are found, reporting any remediation changes without modifying stack state. The command is particularly beneficial for developers as it provides a local feedback loop for testing policy packs and offers two output modes—human-readable diff and JSON for structured data—which are useful in AI-assisted policy workflows. These features enable agents to propose, test, and refine policy rules efficiently, ensuring compliance without triggering a full preview. The command is available in Pulumi v3.229.0, and users can upgrade their Pulumi version to access it, allowing them to validate policy behavior quickly before deployment.