Skip to content
Latchkey

pulumi destroy: Usage, Options & Common CI Errors

Delete all resources in a stack - for ephemeral and preview environments.

pulumi destroy removes every resource a stack manages. It is the inverse of pulumi up and is most useful for tearing down PR preview stacks or ephemeral test environments in CI.

What it does

pulumi destroy deletes all resources tracked in the selected stack’s state, in dependency order. The stack itself and its config remain (use pulumi stack rm to remove those). In CI you pass --yes for an unattended teardown.

Common usage

Terminal
# Destroy the selected stack (prompts)
pulumi destroy --stack acme/pr-123

# CI teardown: no prompt
pulumi destroy --stack acme/pr-123 --yes

# Destroy then remove the empty stack entirely
pulumi destroy --stack acme/pr-123 --yes
pulumi stack rm acme/pr-123 --yes

Common error in CI: resource protected from deletion

destroy fails with "error: refusing to delete protected resource ... To delete this resource, ... remove the protect flag". A resource was created with protect=true. Fix: clear protection first with pulumi state unprotect <urn> --yes (or remove protect in code and run pulumi up), then re-run destroy with --yes. For ephemeral PR stacks, avoid setting protect at all so automated cleanup never blocks.

Key options

OptionPurpose
--yes / -yAuto-approve (required in CI)
--stack NAMETarget stack to destroy
--skip-previewSkip the preview step
--non-interactiveNever prompt
--exclude-protectedSkip protected resources

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →