pulumi refresh: Usage & Common CI Errors
Reconcile Pulumi state with the real world before you deploy.
pulumi refresh queries the actual state of every resource from its provider and updates the stack’s state to match, surfacing drift made outside Pulumi.
What it does
pulumi refresh reads each managed resource from its cloud provider and rewrites the stack state to reflect reality - without changing your program or the resources themselves. Running it before pulumi up means the next update diffs against current truth, not stale state.
Common usage
# Refresh state, prompting to accept
pulumi refresh --stack acme/prod
# CI: refresh without a prompt
pulumi refresh --stack acme/prod --yes
# Refresh as part of an update
pulumi up --refresh --yes --stack acme/prodCommon error in CI: refresh reports unexpected drift / deletions
refresh shows resources marked for deletion ("This resource no longer exists") or large drift, and a following up tries to recreate them. Usually a resource was deleted or changed manually. Fix: review the refresh diff before accepting; pass --yes only in pipelines you trust to auto-reconcile. Ensure the runner has the same provider credentials/region as the original deploy - wrong credentials make real resources look absent and trigger spurious recreation.
Key options
| Option | Purpose |
|---|---|
| --yes / -y | Auto-approve (required in CI) |
| --stack NAME | Target stack |
| --skip-preview | Skip the preview step |
| --clear-pending-creates | Clear interrupted pending creates |