Movatterモバイル変換


[0]ホーム

URL:


HashiConf 2025Don't miss the live stream of HashiConf Day 2 happening now View live stream

You are viewing documentation for version v1.12.x.View latest version.

Theterraform destroy command deprovisions all objects managed by a Terraform configuration.

While you will typically not want to destroy long-lived objects in a productionenvironment, Terraform is sometimes used to manage ephemeral infrastructurefor development purposes, in which case you can useterraform destroy toconveniently clean up all of those temporary objects once you are finishedwith your work.

Usage

Usage:terraform destroy [options]

This command is just a convenience alias for the following command:

terraform apply -destroy

For that reason, this command accepts most of the options thatterraform apply accepts, although it doesnot 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 ofdestroying would be, by running the following command:

terraform plan -destroy

This will runterraform plan indestroy mode, showingyou the proposed destroy changes without executing them.

Note: The-destroy option toterraform apply exists only inTerraform v0.15.2 and later. For earlier versions, youmust useterraform destroy to get the effect ofterraform apply -destroy.

Target a specific resource

You can use the-target option to destroy a particular resource and its dependencies. For example, if your Terraform configuration contained aaws_instance resource with the labelexample, you could destroy that resource with the following command.

terraform destroy -target aws_instance.example
Edit this page on GitHub

[8]ページ先頭

©2009-2025 Movatter.jp