Pulumi Refresh & Drift Remediation Prompt
Detect and safely reconcile out-of-band drift between a Pulumi stack's state and live cloud reality — deciding per resource whether to adopt, revert, or ignore the change without triggering an unwanted replace.
- Target user
- Platform engineers operating live Pulumi stacks across teams
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior platform engineer who owns a fleet of long-lived Pulumi stacks that multiple teams touch — some through code, some through the console or an incident-time CLI hotfix. Your job is to turn a noisy `pulumi refresh` into a precise, per-resource remediation plan that never replaces stateful infrastructure by accident. I will provide: - The Pulumi language (TypeScript, Python, Go, or .NET), org/project/stack, and backend (Pulumi Cloud or self-managed S3/GCS/Azure Blob) - The output of `pulumi refresh --diff --preview-only` (or I will describe the drift) - Which resources are stateful/protected (databases, buckets, DNS zones) and which are safe to churn - The change-management constraints (maintenance window, approvals, whether console edits are sanctioned) Your job: 1. **Classify each drifted resource** into: (a) *adopt* — the out-of-band change is desirable, fold it into code so state and code agree; (b) *revert* — the change was unauthorized, let Pulumi restore the declared value; (c) *ignore* — a provider-managed or noisy field that should be suppressed with `ignoreChanges`. State the reasoning per resource. 2. **Refresh vs. up semantics** — explain precisely what `pulumi refresh` writes to state versus what the next `pulumi up` will do, and where the trap is: a refresh that adopts a physical change can make a later `up` plan a *replace* if an immutable property drifted. Flag every drifted property that is replace-triggering for its provider. 3. **Adopt workflow** — for each adopt case, give the exact code change (property value, `ignoreChanges`, or `transformations`) so that after applying it `pulumi preview` shows zero diff. Prefer editing code over leaving state ahead of code. 4. **Revert workflow** — for each revert case, confirm the `up` will restore the value in place (not replace), and show how to verify with a targeted preview (`pulumi preview --target 'urn:...'`). 5. **Protect & blast radius** — verify `protect: true` and `retainOnDelete` are set on stateful resources before any remediation, and order the remediation so a mistake can only hit one blast-radius group. 6. **Snapshot & rollback** — the `pulumi stack export > snapshot.json` step before touching anything, and how to `pulumi stack import` to roll back if remediation goes sideways. Output as: (a) a per-resource classification table (adopt/revert/ignore + replace-risk flag), (b) the concrete code edits for adopt cases, (c) the targeted-preview verification commands, (d) a snapshot/rollback runbook. Assume production traffic depends on these resources.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Pulumi Brownfield Import & Bulk Adoption Prompt
Adopt an existing, hand-built cloud estate into Pulumi safely — bulk-importing live resources into state, generating matching program code, and reconciling drift without destroying or recreating anything in production.
-
Pulumi Secrets Provider Migration & Key Rotation Prompt
Migrate a Pulumi stack's secrets provider (passphrase to KMS/Vault or between clouds) and rotate the encryption key so all encrypted config and state secrets are re-wrapped without leaking plaintext.
-
Pulumi Transformations & Aliases Refactor Prompt
Refactor Pulumi resource names, parents, and structure at scale using aliases and stack transformations so URNs change on paper but no live resource is destroyed or replaced.
-
IaC State Backend & Topology Strategy Prompt
Design where IaC state lives and how it's split — remote backends, locking, and state/stack boundaries — so blast radius is contained, plans stay fast, and teams can work without stepping on each other, across any stateful IaC tool.
More Infrastructure as Code prompts & error guides
Browse every Infrastructure as Code prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.