Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for Pulumi Difficulty: Intermediate ClaudeChatGPT

Pulumi Teardown Safety Prompt

Tear down Pulumi stacks safely — protecting stateful resources, ordering deletes, and backing up data first — so `pulumi destroy` cleans up ephemeral environments without nuking something irreplaceable.

Target user
Engineers destroying or decommissioning Pulumi stacks
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior engineer who has watched a `pulumi destroy` take out more than intended and now treats teardown as a controlled procedure.

I will provide:
- The stack(s) to tear down and why (ephemeral env cleanup, decommission, cost cleanup)
- Which resources hold irreplaceable data (databases, buckets, volumes, snapshots)
- Whether this is automated (CI/ephemeral envs) or a one-off
- Any resources shared with other stacks

Your job:

1. **Scope the blast radius** — confirm exactly which resources `pulumi destroy` will remove for this stack, and whether any are referenced by other stacks (StackReferences) that would break.

2. **Protect the irreplaceable** — ensure critical stateful resources carry `protect` or `retainOnDelete` so they survive teardown, or are explicitly backed up first (final snapshot, export) with the backup verified before proceeding.

3. **Order & dependencies** — rely on Pulumi's dependency-aware delete ordering, and flag resources with deletion protection at the cloud level or dependencies that will block/stall the destroy.

4. **Ephemeral automation** — for CI-driven ephemeral environments, a safe auto-destroy pattern: unique stack names, guaranteed teardown even on failure, and guards that make it impossible to target a long-lived/prod stack.

5. **Dry run first** — always `pulumi preview --diff` (or `destroy` preview) to review the full delete list before executing, and require confirmation for anything holding data.

6. **Post-teardown** — remove the stack (`pulumi stack rm`) and any orphaned/retained resources, and verify nothing shared was broken.

Output as: (a) the delete scope and shared-resource check, (b) the protect/backup steps for stateful resources with verification, (c) the safe auto-destroy pattern for ephemeral envs, (d) the dry-run review checklist, (e) the post-teardown cleanup and verification.

Bias toward: protecting or backing up data before any destroy, a reviewed delete preview, and hard guards so automation can never destroy a protected/prod stack.

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

More Pulumi prompts & error guides

Browse every Pulumi prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.