Using terraform 0.14.2, running terraform init, I’m seeing
Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Finding latest version of hashicorp/fastly...
- Reusing previous version of hashicorp/http from the dependency lock file
- Reusing previous version of hashicorp/aws from the dependency lock file
- Reusing previous version of fastly/fastly from the dependency lock file
- Installing hashicorp/http v2.0.0...
- Installed hashicorp/http v2.0.0 (signed by HashiCorp)
- Installing hashicorp/aws v3.22.0...
- Installed hashicorp/aws v3.22.0 (signed by HashiCorp)
- Installing fastly/fastly v0.21.2...
- Installed fastly/fastly v0.21.2 (signed by a HashiCorp partner, key ID 508A0A1DCC9FE27E)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider
hashicorp/fastly: provider registry registry.terraform.io does not have a
provider named registry.terraform.io/hashicorp/fastly
The most likely thing is that you’re using Fastly in a child module – required_providers is a per-module concept, and the default “implied provider” behavior for hashicorp-namespace providers is meant to be an assist, but unfortunately results in this confusing behavior.
Does making sure your child modules have required_providers help?
Well, I’m wondering which item raises pulling hashicorp/fastly and wanted to exclude applying the lock file. Is this a new code base or did you migrate from previous terraform version and have a state around?
Thanks for the info. I did upgrade this module from 0.12.29 to 0.13.5 to 0.14.2. I removed the local state before running terraform init. I just went and double checked the remote state file. It used version 0.14.2 and the only reference to fastly provider is registry.terraform.io/fastly/fastly. I’m also pretty stumped as to where/why it’s trying to pull hashicorp/fastly
Terraform defaults to using the HashiCorp namespace if it finds a reference to a provider in a context where there isn’t an explicit provider_requirements entry in scope. The trick here is going to be trying to figure out where Terraform is finding that reference.
I think the next thing I’d try here, based on what’s been discussed already, is to run the terraform providers command to see if it gives a clue as to which module has this implied dependency on hashicorp/fastly. If you run that command and aren’t sure how to interpret the result then you could share the output here and I’d be happy to try to identify some next steps based on what Terraform reports.
Oh that’s very helpful. I found the module that’s trying to find hashicorp/fastly. It was hiding over in another repo that obscures its remote state. It was indeed relying on finding the implied dependency.