Closed bdelvecchio closed 4 years ago
This issue suggests there might be a relationship to these errors and modules. They said it went away when they added the config reference to both the root module and the submodule. Might be worth a try if you haven't already?
Yes, that definitely looked related.
From that report I discovered this command, which helped me resolve the problem:
$ terraform providers
Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/aws]
├── provider[registry.terraform.io/nbering/ansible] 1.0.4
├── module.security_group
│ └── provider[registry.terraform.io/hashicorp/aws]
├── module.swarm_master
│ ├── provider[registry.terraform.io/hashicorp/aws]
│ └── provider[registry.terraform.io/hashicorp/ansible]
└── module.vpc
└── provider[registry.terraform.io/hashicorp/aws]
Providers required by state:
provider[registry.terraform.io/-/aws]
provider[registry.terraform.io/-/ansible]
I stated that I had added the required_providers clause to the modules, but I obviously missed one!.
OK, thanks for your help @nbering! I updated the first post in this issue with the solution, in case anyone else stumbles upon this. I'll also close this issue, since I'm fully working now.
I'm glad you got it working!
Hi Guy's I am facing the same issue. How Can I fix this. I am using tf v1.2.4.. How can I solve this issue???
[Edited] This summarizes the steps that resulted in a successful upgrade for me. But I had missed this important step: If
tf init
complains that it can't findhashicorp/ansible
, that means one of your modules is using theansible
plugin (say, by declaring anansible_group
resource) but does not have a required_provider statement! Could be your root module or any included module._TLDR: This error means you need to add a
required_providers
block to all the modules which listhashicorp/ansible
as a provider in the output ofterraform providers
._[moved from #32]
When upgrading to Terraform 0.13.x, I'm having problems related to moving from the manually-installed
hashicorp/ansible
plugin to a registry-installed version:First, I added the necessary
required_providers
block to my root module:Now when I run
tf init --upgrade
it still fails looking for the older name:Even after replacing the provider in my project state:
It feels like the state still contains the reference to
hashicorp/ansible
even though no resources have been moved to the new provider. [EDIT] it's not the state that's holding the stale reference--it's strictly the code. Useterraform providers
to identify the module with the dangling reference, and add arequired_providers
block to that module.