pulumi-destroy
Delete Pulumi infrastructure and state
TLDR
Destroy all resources in the current stack
Destroy all resources in a specific stack
Automatically approve and destroy resources after previewing
Exclude protected resources from being destroyed
Remove the stack and its configuration file after all resources in the stack are deleted
Continue destroying the resources, even if an error is encountered
SYNOPSIS
pulumi destroy [flags]
PARAMETERS
--yes
Automatically approve the destruction without prompting for confirmation.
--message
Optional message to associate with the destruction event.
--target
Only destroy resources with the given name. May be specified multiple times.
--target-dependents
Allows destroying any resource listed in --target and all resources that depend on it
--parallel
Allow up to N resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded.
--plan
Show a plan of the resources to be destroyed without performing the destruction. The resources listed will be deleted when the command is exectuted without the plan option.
--force
Forces a destroy even if resources report errors.
--config-file
Use the configuration file at the specified path rather than the default (Pulumi.
This flag is available in the pulumi destroy command since v3.14.0.
--skip-pending-creates
Skip resources that haven't been created yet.
DESCRIPTION
The pulumi-destroy command is used to tear down and remove all resources managed by a specific Pulumi stack. This process effectively reverts the infrastructure deployment defined in the Pulumi program associated with that stack. It's a crucial command for cleaning up resources, rolling back deployments, or decommissioning environments. The command prompts for confirmation before proceeding with the destruction, requiring a 'yes' response to prevent accidental data loss. pulumi-destroy outputs progress and status information during the destruction process, allowing users to monitor the decommissioning of each resource. After successful execution, the underlying cloud provider no longer manages those resources, potentially saving on cloud costs. Remember this does not delete the state file; use 'pulumi stack rm' for that. You can customize destruction behavior via flags that influence parallelism or force a destroy even if resources report errors.
CAVEATS
Ensure you have the correct stack selected before running pulumi-destroy, as it will remove all resources associated with that stack. Double-check the plan output (using `--plan`) to verify the expected resources are targeted for removal. It's irreversible without backups unless the resources were deployed using Pulumi.
EXIT CODES
pulumi destroy returns a non-zero exit code in case of failure. This can be useful to ensure successful execution in automation.
CONFIGURATION
pulumi-destroy respects the Pulumi configuration system, allowing you to define environment-specific settings that influence the behavior of your infrastructure. Consider using configuration files (Pulumi.
SEE ALSO
pulumi up(1), pulumi stack(1), pulumi refresh(1)