Interview Prep/Terraform/Import Refactoring Drift and Lifecycle

A teammate runs `terraform state mv` ad hoc in prod. What do you recommend instead?

BeginnerScenarioImport Refactoring Drift and Lifecycle
Answer

Situation read → Imperative state surgery with no review.

What I'd do →

  1. Replace it with a moved block committed in a PR.
  2. Keep state mv for cross-state moves or emergencies, with a state backup first.

Why → moved blocks apply the same migration in every environment and leave a history in Git.

Interview tip → Always terraform state pull > backup.json before any manual state command.

All Terraform questions Roadmap: Terraform in production

More on Import Refactoring Drift and Lifecycle