Terraform State MV and Infrastructure Identity

Terraform does not track infrastructure by visual code layout.
It tracks infrastructure through state addresses.

A renamed resource block looks like deletion and recreation unless the Terraform state mapping changes with it.

This lesson explains how terraform state mv rewrites Terraform’s internal address mapping while preserving the same remote infrastructure object. The video also covers module refactors, for_each key changes, and why incorrect state moves can silently redirect infrastructure control.

Understanding this distinction is critical before performing large Terraform refactors in production environments.

https://youtu.be/RmjoNyr-6L0