Files
opentf/website/docs/commands/destroy.html.markdown
Laura Martin 6e1e614a56 Change -force to -auto-approve when destroying
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.
2018-02-01 00:14:42 +00:00

32 lines
975 B
Markdown

---
layout: "docs"
page_title: "Command: destroy"
sidebar_current: "docs-commands-destroy"
description: |-
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](/docs/commands/apply.html) 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.