Interview Prep/Terraform/State Internals

What does `terraform state replace-provider` do?

IntermediateConceptState Internals
Answer

It rewrites the provider address recorded for resources in state, needed when a provider's source changes, such as registry.terraform.io/-/aws to hashicorp/aws, or when moving to OpenTofu or a private mirror namespace.

terraform state replace-provider registry.terraform.io/hashicorp/aws registry.example.com/acme/aws
All Terraform questions Roadmap: Terraform in production

More on State Internals