Pulumi
Preview Pulumi stack changes
Preview a Pulumi stack to review planned creates, updates, replacements, and deletions. Use the CLI for the full diff and the Automation API to consume per-operation counts in code.
Documentation reviewed · 2 methods with sources
Ways to do it
CLI
pulumi preview
Compute proposed resource changes without applying them.
Read source: Pulumi preview command- Requirements
- The Pulumi CLI, a project, state backend access, and credentials for any providers the program reads.
- Limitations
- The diff compares the program with recorded stack state by default. Add --refresh when the preview needs to account for changes outside Pulumi.
Example shell
pulumi preview --stack "$PULUMI_STACK" --diff --non-interactiveSDK
stack.preview()
Run a dry-run update on a selected Node.js Automation API Stack and read its changeSummary map.
Read source: Pulumi Node.js Automation API Stack.preview- Requirements
- An initialized Stack from the @pulumi/pulumi Automation API, the Pulumi CLI, and access to the stack backend and providers.
- Limitations
- Preview still runs the project program. The change summary counts operations, while onOutput streams the detailed preview.
Example text
const result = await stack.preview({ onOutput: console.log });
console.log(result.changeSummary);