0
0
Terraformcloud~5 mins

Terraform destroy for cleanup - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aterraform validate
Bterraform plan -destroy
Cterraform init
Dterraform apply
Which flag helps avoid accidental destruction by requiring confirmation?
A-auto-approve=false
B-auto-approve=true
C-force
D-skip-confirm
What happens if you run terraform destroy in a directory without Terraform state?
AIt does nothing because no resources are tracked
BIt destroys all cloud resources in your account
CIt creates new resources
DIt throws an error and exits
Which of these is NOT a reason to use terraform destroy?
AClean up test environments
BRemove unused resources
CUpdate resource configurations
DSave cloud costs by deleting resources
Does terraform destroy delete resources outside Terraform's control?
AYes, it deletes all resources in the cloud account
BYes, but only if you use a special flag
CNo, it only deletes local files
DNo, only resources tracked in Terraform state are deleted
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.