Interview Prep/Terraform/Refactoring, Migration and Drift

What is your workflow for refactoring Terraform safely?

IntermediateProductionRefactoring, Migration and Drift
Answer

Make the change in a branch, add moved blocks for renamed or relocated addresses and run terraform plan: the goal is "no changes" (plus move notes). Apply in dev first. If the plan shows destroy and create where you expected a move, stop and fix the addresses. Never combine a refactor with a functional change in one PR.

All Terraform questions Roadmap: Terraform in production

More on Refactoring, Migration and Drift