0
0
Terraformcloud~20 mins

Terraform destroy for cleanup - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Destroy Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
1:30remaining
What happens when you run terraform destroy?
You have applied a Terraform configuration that created several cloud resources. Now you run terraform destroy. What is the expected result?
ATerraform deletes all resources it created according to the state file.
BTerraform only deletes resources that are manually tagged for deletion.
CTerraform archives the resources but does not delete them.
DTerraform creates a backup of resources and leaves them running.
Attempts:
2 left
💡 Hint
Think about what Terraform tracks and how it manages resources.
Configuration
intermediate
1:30remaining
Which command safely destroys resources with confirmation?
You want to destroy your Terraform-managed infrastructure but want to ensure you confirm before deletion. Which command should you use?
Aterraform destroy -auto-approve
Bterraform apply -destroy
Cterraform delete
Dterraform destroy
Attempts:
2 left
💡 Hint
Consider which command asks for confirmation by default.
security
advanced
2:00remaining
What is a best practice to avoid accidental resource deletion with terraform destroy?
You want to prevent accidental destruction of critical resources when running terraform destroy. Which approach is best?
ARun <code>terraform destroy</code> with <code>-auto-approve</code> to speed up deletion.
BUse resource lifecycle block with <code>prevent_destroy = true</code> on critical resources.
CRemove the state file before running <code>terraform destroy</code>.
DManually delete resources in the cloud console before running <code>terraform destroy</code>.
Attempts:
2 left
💡 Hint
Think about how Terraform can protect resources from deletion.
Architecture
advanced
2:00remaining
How does Terraform handle dependencies during terraform destroy?
When destroying resources, how does Terraform manage the order of deletion to avoid errors?
ATerraform deletes resources in reverse order of creation based on dependency graph.
BTerraform deletes all resources simultaneously without order.
CTerraform deletes resources alphabetically by resource name.
DTerraform requires manual deletion order specified by the user.
Attempts:
2 left
💡 Hint
Think about how Terraform tracks resource relationships.
Best Practice
expert
2:30remaining
What is the recommended way to clean up Terraform-managed infrastructure in a CI/CD pipeline?
You want to automate infrastructure cleanup in a CI/CD pipeline after tests complete. Which approach follows best practices?
ARemove Terraform state files from the pipeline workspace to trigger cleanup.
BManually run <code>terraform destroy</code> on local machine after pipeline finishes.
CRun <code>terraform destroy -auto-approve</code> with proper state backend configured and environment variables securely set.
DDelete cloud resources directly via cloud provider console after pipeline.
Attempts:
2 left
💡 Hint
Consider automation, security, and state management.