DELAPARRA
Index
Color
NL
Category: Terraform

destroy

Explained by Updated

What is destroy?

destroy: Removes everything Terraform manages in this state. The same as a plan where every resource is being deleted. terraform destroy removes every resource managed by the current Terraform configuration and state. It shows a plan of everything that will be deleted and asks for confirmation. It is useful for temporary environments, such as a test setup created for one feature and removed afterwards. Used on production by mistake, it can delete servers, databases and storage in minutes.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about destroy

What should you keep in mind with destroy?

Protect important resources. Many providers support deletion protection on databases, and Terraform's prevent_destroy lifecycle setting refuses to delete a resource at all. Keep production in a separate state and workspace from experiments, so destroying a test environment cannot touch it. Make sure backups exist outside the resources Terraform manages, because destroying a database usually destroys its automatic backups as well.

What does an example of destroy look like?

terraform destroy -target=aws_s3_bucket.logs

At a glance

CategoryTerraform
Explained by
Updated

More Terraform terms

All terms starting with D

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.