Challenge - 5 Problems
Terraform State Refactoring Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What does the Terraform command
terraform state mv do?Choose the best description of what
terraform state mv accomplishes during infrastructure refactoring.Attempts:
2 left
💡 Hint
Think about how Terraform tracks resources internally versus what happens in the cloud.
✗ Incorrect
The terraform state mv command changes resource addresses inside the Terraform state file. It does not affect the actual cloud resources but helps Terraform understand resource renaming or refactoring.
❓ Configuration
intermediate2:00remaining
Which
terraform state mv command correctly renames a resource?You have a resource named
aws_instance.old_name and want to rename it to aws_instance.new_name in the Terraform state. Which command will do this correctly?Attempts:
2 left
💡 Hint
The first argument is the current resource address, the second is the new address.
✗ Incorrect
The syntax is terraform state mv [current_address] [new_address]. Option A correctly moves the resource from old_name to new_name.
❓ Architecture
advanced2:00remaining
What is the impact of using
terraform state mv on the actual cloud infrastructure?After running
terraform state mv to rename a resource in the state file, what happens to the real resource in the cloud provider?Attempts:
2 left
💡 Hint
Consider what Terraform state represents versus actual cloud resources.
✗ Incorrect
terraform state mv only updates the state file. It does not modify or recreate any real cloud resources.
❓ security
advanced2:00remaining
What security risk can arise if
terraform state mv is used incorrectly during refactoring?If you move a resource in the Terraform state to a wrong address or to a resource managed by another team, what security risk might occur?
Attempts:
2 left
💡 Hint
Think about what happens if Terraform thinks it owns resources it does not.
✗ Incorrect
Incorrect state moves can cause Terraform to manage resources it shouldn't, leading to accidental overwrites or deletions.
✅ Best Practice
expert2:00remaining
What is the recommended best practice before running
terraform state mv in a team environment?Before moving resources in the Terraform state file during refactoring, what should you do to avoid conflicts and errors?
Attempts:
2 left
💡 Hint
Think about how teams share Terraform state and avoid race conditions.
✗ Incorrect
Locking the state prevents others from making changes at the same time. Informing the team avoids confusion and conflicts.