Challenge - 5 Problems
Terraform Destroy Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate1: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?Attempts:
2 left
💡 Hint
Think about what Terraform tracks and how it manages resources.
✗ Incorrect
Terraform destroy uses the state file to identify and delete all resources it manages, cleaning up the infrastructure.
❓ Configuration
intermediate1: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?
Attempts:
2 left
💡 Hint
Consider which command asks for confirmation by default.
✗ Incorrect
The command 'terraform destroy' asks for confirmation before deleting resources unless '-auto-approve' is used.
❓ security
advanced2: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?Attempts:
2 left
💡 Hint
Think about how Terraform can protect resources from deletion.
✗ Incorrect
Setting
prevent_destroy = true in the lifecycle block stops Terraform from deleting those resources, preventing accidents.❓ Architecture
advanced2:00remaining
How does Terraform handle dependencies during
terraform destroy?When destroying resources, how does Terraform manage the order of deletion to avoid errors?
Attempts:
2 left
💡 Hint
Think about how Terraform tracks resource relationships.
✗ Incorrect
Terraform builds a dependency graph and deletes resources in reverse order to respect dependencies and avoid errors.
✅ Best Practice
expert2: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?
Attempts:
2 left
💡 Hint
Consider automation, security, and state management.
✗ Incorrect
Automating terraform destroy with auto-approve and secure state backend ensures reliable, repeatable cleanup in pipelines.