Warning: Terraform Provider Moved
Recently I had an issue where Terraform did not seem to be loading the correct provider. I was getting the following result from a terraform init -upgrade
even though I had updated the provider name in versions.tf
|
|
What appeared to be the issue is that changing the provider source in versions.tf
like below did not result in the underlying resources using the new provider.
|
|
This makes sense once you realize what Terraform is doing. You wouldn’t want someone to accidentally swap the source of a provider to something different entirely.
You can see this in Terraform’s state. Go ahead and pull your state to stdout
by running terraform state pull
and you will find that each resource includes a provider.
|
|
Now you can go through the trouble of pulling your state file and manually making the changes and pushing it again, but the correct way to update it is to use the following command:
|
|
Or for my cloudflare example:
|
|
Terraform will show you what resources you will be changing with this command and ask you to confirm.