Recall & Review
beginner
What does the
terraform destroy command do?It removes all the infrastructure resources that were created by Terraform in the current workspace, effectively cleaning up your cloud environment.
Click to reveal answer
beginner
Why should you be careful when running
terraform destroy?Because it permanently deletes all managed resources, which can cause data loss or service downtime if done unintentionally.
Click to reveal answer
intermediate
How can you preview what
terraform destroy will delete before actually running it?By running
terraform plan -destroy, which shows a detailed plan of resources that will be destroyed.Click to reveal answer
intermediate
What is a safe practice to avoid accidental destruction when using
terraform destroy?Use the
-auto-approve=false flag to require manual confirmation before destruction happens.Click to reveal answer
beginner
Can
terraform destroy remove resources not managed by Terraform?No, it only removes resources that are tracked in Terraform's state file. Unmanaged resources remain untouched.
Click to reveal answer
What command shows what will be deleted before running
terraform destroy?✗ Incorrect
terraform plan -destroy previews the destruction plan without making changes.Which flag helps avoid accidental destruction by requiring confirmation?
✗ Incorrect
Setting
-auto-approve=false makes Terraform ask for confirmation before destroying.What happens if you run
terraform destroy in a directory without Terraform state?✗ Incorrect
Without state, Terraform does not know what to destroy, so it does nothing.
Which of these is NOT a reason to use
terraform destroy?✗ Incorrect
Updating resources is done with
terraform apply, not destroy.Does
terraform destroy delete resources outside Terraform's control?✗ Incorrect
Terraform only deletes resources it manages and tracks in its state file.
Explain the purpose and safe usage of
terraform destroy.Think about why and how you would delete cloud resources safely.
You got /5 concepts.
Describe how Terraform knows which resources to delete when running
terraform destroy.Consider what Terraform uses to remember your infrastructure.
You got /4 concepts.