mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
Since an early version of Terraform, the `destroy` command has always had the `-force` flag to allow an auto approval of the interactive prompt. 0.11 introduced `-auto-approve` as default to `false` when using the `apply` command. The `-auto-approve` flag was introduced to reduce ambiguity of it's function, but the `-force` flag was never updated for a destroy. People often use wrappers when automating commands in Terraform, and the inconsistency between `apply` and `destroy` means that additional logic must be added to the wrappers to do similar functions. Both commands are more or less able to run with similar syntax, and also heavily share their code. This commit updates the command in `destroy` to use the `-auto-approve` flag making working with the Terraform CLI a more consistent experience. We leave in `-force` in `destroy` for the time-being and flag it as deprecated to ensure a safe switchover period.
975 B
975 B
layout | page_title | sidebar_current | description |
---|---|---|---|
docs | Command: destroy | docs-commands-destroy | The `terraform destroy` command is used to destroy the Terraform-managed infrastructure. |
Command: destroy
The terraform destroy
command is used to destroy the Terraform-managed
infrastructure.
Usage
Usage: terraform destroy [options] [dir]
Infrastructure managed by Terraform will be destroyed. This will ask for confirmation before destroying.
This command accepts all the arguments and flags that the apply command accepts, with the exception of a plan file argument.
If -auto-approve
is set, then the destroy confirmation will not be shown.
The -target
flag, instead of affecting "dependencies" will instead also
destroy any resources that depend on the target(s) specified.
The behavior of any terraform destroy
command can be previewed at any time
with an equivalent terraform plan -destroy
command.