All Tools View Categories About Contact Privacy

Terraform Destroy Command Builder

Assemble a terraform destroy command with -auto-approve, -target and more.

Runs entirely in your browser - nothing is uploaded and no Terraform connection is made.
Your terraform destroy command will appear here.

About Terraform Destroy Command Builder

The Terraform Destroy Command Builder assembles a correct terraform destroy command from a simple form, so you never have to memorize or mistype the flags. Destroy is one of the most dangerous Terraform operations because it removes real infrastructure, so the builder requires explicit confirmation before it will produce any output.

Because destruction is irreversible, the tool forces -auto-approve to be enabled and then lets you add one or more -target addresses, -var-file paths, and -var key value pairs. Every address and variable is validated client-side, and the assembled command respects shell quoting rules when values contain spaces. Nothing is sent to Terraform or any cloud; the command is built entirely in your browser and can be copied, downloaded as a shell snippet, or printed for a change record. It is a practical safeguard for runbooks, incident response, and teaching operators how targeted destroys should look.

Using a generated command also helps during review. Because the exact flags are spelled out, a teammate can read the command in a pull request or a chat message and understand precisely what will be removed, which reduces the chance of an accidental wide-scale destroy. Pair the command with -target to keep the impact narrow and predictable, and keep the downloaded snippet as evidence of what was approved. For incident response this consistency matters: the same inputs always produce the same command, so you can trust a saved snippet weeks later.

The builder never contacts Terraform or a cloud provider, so it cannot itself destroy anything. It only prints the command you would run yourself in a terminal. That separation keeps the tool safe to open on a laptop, share in documentation, or demonstrate in a training session without any risk to live infrastructure.

Features

  • -auto-approve required - the command will not build until you enable it.
  • Multiple targets - add as many -target addresses as you need, one per line.
  • Variable files - include several -var-file paths.
  • Variables - pass -var key=value pairs that are validated for the equals sign.
  • Directory option - target a specific directory or keep the default.
  • Shell quoting - values with spaces are wrapped in single quotes automatically.
  • Client-side validation - bad addresses and malformed variables are caught before output.
  • Copy, download and print - export the command as a shell snippet.
  • No cloud connection - the command is assembled locally only.
  • Safe by default - refuses to emit a destroy without explicit approval.
  • Reproducible - the same inputs always yield the same command.
  • Review friendly - the exact flags are visible for change review.
  • Evidence friendly - download a snippet as a record of what was approved.

How to Use

  1. Open the builder and review the options panel on the left.
  2. Enable -auto-approve using the checkbox; the tool blocks output until you do.
  3. List target addresses if you want a scoped destroy, one resource address per line.
  4. Add variable files and -var key=value pairs as needed for your configuration.
  5. Optionally set a directory when the configuration lives outside the current folder.
  6. Build the command and review it in the preview panel on the right.
  7. Export with Copy, Download as a shell file, or Print.
  8. Start over with Clear, or load a realistic example with Load sample.
  9. Review validation if anything is wrong, fix the flagged fields, and rebuild.

Examples

Example 1 - everything. Enable -auto-approve with no targets to produce terraform destroy -auto-approve, which removes all resources in the current configuration.

Example 2 - one target. Enable -auto-approve and add the single target aws_instance.foo to produce terraform destroy -auto-approve -target=aws_instance.foo, limiting the blast radius to that resource.

Example 3 - variables. Add -var-file=prod.tfvars and -var=env=prod so the destroy uses the right variable values.

Example 4 - spaced values. A target that contains a space is automatically wrapped in single quotes so the shell treats it as one argument, which prevents the command from breaking when paths or names include spaces.

Benefits

  • Safe by default - refuses to build without -auto-approve.
  • Correct syntax - flags and quoting assembled correctly.
  • Targeted destroys - scope removal with -target addresses.
  • Portable - copy, download, or print the command.
  • Private - nothing is uploaded or sent anywhere.
  • Runbook ready - produce repeatable, documented commands.
  • Reviewable - exact flags are visible to reviewers.
  • Training aid - demonstrate destroys safely without risk.

Frequently Asked Questions

What does terraform destroy do?
terraform destroy removes all resources managed by the current configuration.
What flags are supported?
This builder supports -auto-approve, -var-file, -var and -target.
Why is -auto-approve required here?
Destroy is irreversible, so the builder forces -auto-approve to be explicit before producing the command.
Are multiple -target values allowed?
Yes. Enter one resource address per line; each becomes a separate -target flag.
Does this connect to Terraform?
No. The command is assembled in your browser and nothing is uploaded.
Can I download it?
Yes. Copy the command, download it as a shell snippet, or print it.