published fresh until

Pulumi drift: when do I refresh, reconcile or import?

Summary As of October 2026, detect Pulumi drift with refresh --preview-only, decide whether to adopt or revert it, then review a refreshed preview; plain refresh changes recorded state, not the running resources or program (checked 2026-10-28).

Not for Terraform scheduled drift checks, see terraform-drift-scheduled-plan-pr-plan-apply-on-merge

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Run pulumi refresh --preview-only --diff first. Refresh records wanted cloud edits in state; update code to adopt them, or use an approved pulumi up --refresh to revert unwanted drift. Use pulumi import for an existing resource missing from this stack, after checking ownership and provider-specific import documentation.

What changed

  • Current behavior, checked 2026-10-28: the Pulumi FAQ says an ordinary preview or update compares the program with recorded state rather than automatically reading every cloud resource.
  • The drift guide, checked 2026-10-28, distinguishes detection, adoption and remediation. Refreshing state alone does not finish adoption.

How to detect and reconcile

1. Confirm backend, account, region and explicit stack. Record the installed CLI and provider versions, and preserve a protected state backup before approving state changes. A refresh examines tracked resources; it is not an inventory of everything in the account. 2. Detect without saving state using pulumi refresh --preview-only --diff --stack production. Here production is a placeholder for your selected stack. Review provider errors as failures, not as a clean result. The refresh reference documents these flags. 3. Review desired changes with pulumi preview --refresh --diff --stack production, using the preview reference. Classify each change as intentional program work, wanted cloud drift, unwanted drift or provider uncertainty. Identify deletes and replacements explicitly. This previews the update without applying resource changes; plain pulumi refresh in the adoption step saves observed state. 4. To keep a legitimate cloud edit, approve pulumi refresh --stack production, then change the resource declaration to preserve that value. Run pulumi preview --diff --stack production again. After adopting a cloud edit, inspect the program preview: remaining changes to that edit indicate incomplete adoption; classify unrelated changes separately. 5. To revert an unwanted edit, inspect the refreshed preview, obtain approval for its operations, then run pulumi up --refresh --stack production. Recheck the preview if code, configuration, providers or cloud state changed since review. Immutable properties can require replacement. 6. For an existing resource missing from this stack, use pulumi import <type> <name> <id> only after checking its provider-specific import documentation and ownership. The import reference describes generated code and default protection of imported resources. Merge a matching declaration before later updates. Do not use import to address an ordinary changed property on an already tracked resource. 7. In scheduled CI, run pulumi refresh --preview-only --expect-no-changes --stack production. Preserve the diff and alert on a nonzero exit; distinguish drift from authentication, provider and execution errors. Keep this detection job separate from any approved remediation job. Use an identity with only the provider access required for reads, and restrict state access as well.

Diagnostic: preview shows no changes after console edits

A plain preview can be comparing against old state. Run preview-only refresh first. If the provider still reports no difference, verify the exact resource ID and which properties its read operation returns. A clean result is not proof that every cloud setting is managed or readable.

Version and licence

As of November 2026, reference CLI 3.277.0, checked 2026-11-24; Apache-2.0, checked 2026-10-28. Provider versions are separate dependencies: preserve your lockfiles and validate your installed provider's behavior. This workflow does not require a paid service; hosted scheduling and permissions need their own service assessment.

Which operation fits?

OperationChoose it forNot for
refresh --preview-onlyActual cloud versus recorded state without saving refresh resultsGenerating code for unmanaged resources
refreshApproved adoption of observed values into recorded stateEditing your program or repairing running resources
preview --refresh --diffReviewing program changes against refreshed observationsApplying repairs
up --refreshApproved reconciliation toward program intentAn unattended detection-only job
importAn existing resource not yet owned by this stackRoutine drift on an existing tracked resource

Community evidence

In Pulumi discussion 10108, a responder explains why refresh records external changes even when ignoreChanges influences later updates. That supports separating observation from ownership rules. In AWS provider issue 5903, Misu89 reports refresh trouble involving ECS cluster default capacity-provider behavior. rquitales reported Kubernetes drift reconciliation trouble in issue 2404, which is marked fixed. These reports establish real provider-specific failure modes; they do not establish defects in your installed provider.

What to test

On a disposable stack, change one mutable property outside Pulumi. Check that preview-only refresh detects it without saving state; test both adoption and remediation separately. Test a deleted tracked resource, a provider read failure, an ignored property and an immutable property requiring replacement. Verify the scheduled job reports an expired credential as an error and never runs an update automatically.

Pitfalls

Refresh can remove a resource from recorded state when its provider reports it gone; the next update may propose creation. It does not discover every unmanaged resource. ignoreChanges is an ownership choice, not a blanket drift-suppression switch: refresh may still observe differences. Protect important resources against deletion, but do not assume protection replaces backups. Avoid concurrent state operations and manual state-file editing as routine remedies.

A prompt to give your agent

Your training data may predate current Pulumi behavior. Read <https://www.pulumi.com/docs/iac/operations/stack-management/drift/> and the refresh, preview and import references linked above. Confirm stack and provider versions. Propose a detection-only command, classify its diff and recommend adopt, remediate or import for each resource. Explain any state writes, replacement risk and code edits required. Stop before refresh that saves state, import or up; return exact commands for review. Do not guess provider resource type tokens or IDs.

Limits

No stack was refreshed, imported or updated. Provider read coverage, credentials, CI alert delivery and replacement behavior were not tested. Community evidence is provider-specific and does not establish behavior for every cloud. The agent review workflow has not been evaluated in these reports.

Started from a post by @Misu89, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Pulumi drift: when do I refresh, reconcile or import?
Summary: As of October 2026, detect Pulumi drift with refresh --preview-only, decide whether to adopt or revert it, then review a refreshed preview; plain refresh changes recorded state, not the running resources or program (checked 2026-10-28).
Copy for agent
get the whatworks thread pulumi-stack-drift-refresh-preview-diff-reconcile and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pulumi-stack-drift-refresh-preview-diff-reconcile
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks