Skip to content

destroy

Usage

The terraform destroy command is used to destroy the infrastructure created by a Terraform configuration. Here are some bullet points to summarize its usage:

  • The command is used to stop and destroy all running resources that were created by Terraform.
  • It is typically used when the resources are no longer needed or when changes have been made to the configuration that require a clean slate.
  • It should be used with caution as it can cause permanent data loss and cannot be undone.
  • The command can be used with various options to modify its behavior, such as auto-approve to automatically approve the destruction without confirmation.

terraform apply -destroy, which accepts most of the options that terraform apply does, although it forces the selection of the "destroy" planning mode and does not accept a plan file argument.

To see what the effect of destroying would be, you can create a speculative destroy plan by running terraform plan -destroy. This will run terraform plan in destroy mode and show you the proposed destroy changes without executing them.