pulumi-preview
Preview infrastructure changes before applying them
TLDR
Show a preview of updates to a stack's resources
Show a preview of updates to a stack's resources in JSON format
Preview updates as a rich diff showing overall changes
Display help
SYNOPSIS
pulumi preview [flags]
PARAMETERS
--all
Show all resources, even those that haven't changed.
--color
Colorize output. Choices are: always, never, auto (default 'auto').
--diff
Display detailed diffs for changes.
--exclude-protected
Do not show protected resources in the plan output.
-f, --file
Run Pulumi code from the given file or directory.
-h, --help
Show help for preview.
--message
Attach a message to the preview.
--parallel
Allow parallelism during resource operations (default 1).
--policy-pack
Run one or more policy packs as part of this update.
--policy-pack-config
Configuration to pass to the policy pack.
--profile
Load profile settings from the specified location.
--refresh
Refresh the state of the stack before previewing.
--replace
Specify resources to replace by their URNs.
-s, --stack
The name of the stack to use.
--suppress-outputs
Suppress display of outputs (can be useful when diffing plans).
--target
Specify resources to target for the preview.
--target-dependents
Allows targeting of dependent resources when using --target.
--verbose
Enable verbose logging (e.g., each HTTP request).
-y, --yes
Automatically approve and perform the preview after confirming it.
DESCRIPTION
The pulumi preview
command displays a summary of the proposed changes to a Pulumi stack without actually applying them. It allows users to review what resources will be created, updated, or deleted as a result of running pulumi up
. This is crucial for understanding the impact of code changes on your infrastructure before deploying. The output highlights the differences between the current state of the stack and the desired state defined in your Pulumi program. It shows resource changes (creates, updates, deletes, replaces), property changes for each resource, and any potential issues that might arise during the update. This helps in identifying errors, unexpected modifications, or potential problems before they impact the actual infrastructure. Using pulumi preview
, users can minimize risks and confidently deploy infrastructure changes.
CAVEATS
The preview only simulates the changes. Actual deployments might differ slightly due to external factors.
EXIT CODES
pulumi preview
returns different exit codes depending on the outcome:
0: Success. The preview completed without errors or policy violations.
1: General error. An unexpected error occurred during the preview.
2: Policy violation. One or more policies were violated during the preview.
RESOURCE STATES
The output of pulumi preview
will show each resource with a state:
create: A new resource will be created.
update: An existing resource will be updated.
delete: An existing resource will be deleted.
replace: An existing resource will be replaced (deleted and then created).
HISTORY
pulumi preview
was developed as part of the Pulumi infrastructure-as-code platform. Its purpose is to allow users to see exactly what changes would be made to infrastructure before applying them. It has been a crucial element since early versions of Pulumi, promoting safety and control in infrastructure deployments.
The command has evolved over time with new features and improvements, such as displaying detailed diffs, support for policy packs, and improved performance.