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
More on State Internals
What does the state file contain?BeginnerWhat is the difference between local and remote state?BeginnerHow do you configure the S3 backend?BeginnerWhat is state locking and why does it matter?IntermediateHow does S3-native locking work and how does it replace DynamoDB?AdvancedHow do you inspect resources in state?Beginner