Interview practice question
Renaming a resource in code without destroying it
Cloud & DevOps · Terraform and IaC · Beginner
You want to rename a resource block from "aws_s3_bucket.data" to "aws_s3_bucket.raw_data." The plan shows it would destroy and recreate the bucket. How do you avoid that?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Terraform tracks by address; rename = new address.
- moved block from old to new address.
- Plan shows move, no destroy.
- Or terraform state mv.
- moved block keeps it reviewable.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.