Files
opentf/website/docs/cli/commands/destroy.mdx
2023-09-15 16:03:23 +02:00

42 lines
1.2 KiB
Plaintext

---
description: >-
The opentf destroy command destroys all objects managed by a OpenTF
configuration.
---
# Command: destroy
The `opentf destroy` command is a convenient way to destroy all remote
objects managed by a particular OpenTF configuration.
While you will typically not want to destroy long-lived objects in a production
environment, OpenTF is sometimes used to manage ephemeral infrastructure
for development purposes, in which case you can use `opentf destroy` to
conveniently clean up all of those temporary objects once you are finished
with your work.
## Usage
Usage: `opentf destroy [options]`
This command is just a convenience alias for the following command:
```
opentf apply -destroy
```
For that reason, this command accepts most of the options that
[`opentf apply`](/docs/cli/commands/apply) accepts, although it does
not accept a plan file argument and forces the selection of the "destroy"
planning mode.
You can also create a speculative destroy plan, to see what the effect of
destroying would be, by running the following command:
```
opentf plan -destroy
```
This will run [`opentf plan`](/docs/cli/commands/plan) in _destroy_ mode, showing
you the proposed destroy changes without executing them.