terraform destroy

The command that deletes every resource the current state records, in reverse dependency order.

Run against the wrong state or workspace it deletes real infrastructure and its data.

In more detail

Preview it first with terraform plan -destroy and read the count. It only removes what this configuration's state records; anything made by hand is invisible to it. Afterwards the state file still exists but is empty, and applying again rebuilds everything.

Examples

terraform plan -destroy
terraform destroy

Related terms

Taught in

References

Certification courses