An error where Terraform apply would fail, even though Terraform plan succeeded, when there are nested providers, was reported as being fixed by https://github.com/hashicorp/terraform/pull/25334. I still get this error on Terraform Cloud, using version v0.13.0.
I’m not positive that this is the same error described by PR 25334, because I don’t think I have multiple levels of nesting, but my error is the one from the issues referenced in the PR:
Failed to instantiate provider "registry.terraform.io/-/aws" to obtain schema: unknown provider "registry.terraform.io/-/aws"
I’m getting similar - starting to regret trying to upgrade to 0.13!
I have a remote backend - have done terraform init and terraform plan on my local and then committed via VCS to start the remote build
Error: Could not load plugin Plugin reinitialization required. Please run "terraform init". Failed to instantiate provider "registry.terraform.io/-/aws" to obtain schema: unknown provider "registry.terraform.io/-/aws"
I solved my problem by pulling the state using terraform state pull > state.json and replacing all instances of “registry.terraform.io/-/aws” with “registry.terraform.io/hashicorp/aws” and making sure that everything is using the same AWS provider version
Might be unrelated but also might not - I finally removed all “Quoted identifiers” which are deprecated
I’m glad you found a path forward. I just wanted to add that there is a built-in command that does something similar to what you did manually there:
terraform state replace-provider "registry.terraform.io/-/aws" "registry.terraform.io/hashicorp/aws"
Terraform 0.13 is designed to try to infer the need for this replacement automatically from the configuration where possible, but sometimes other behaviors can interfere with that automatic migration. An explicit migration like the above should address it, in that case.