Terraform init "Failed to query available provider packages" looking for registry.terraform.io/hashicorp/fastly

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

I’ve followed the pattern in https://registry.terraform.io/providers/fastly/fastly/latest

terraform {
  required_providers {
    fastly = {
      source = "fastly/fastly"
      version = "0.21.3"

provider "fastly" {
  # Configuration options

My versions.tf looks like

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = ">= 3.22"
    fastly = {
      source = "fastly/fastly"
      version = ">= 0.21.2"
  required_version = ">= 0.14"

and the only reference to fastly in the config is

provider "fastly" {
  api_key = module.secrets.api_credentials.fastly_terraform_token

I’m not sure why, after successfully finding and installing fastly/fastly it looks for hashicorp/fastly. We’re not using any in-house providers.


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?

1 Like

Thank you for the suggestion! This module does not have any children. For good measure I double checked all the modules that include this one as well, but none of them have Fastly anywhere.

Could you check or remove your .terraform.lock.hcl file?

Thanks for the suggestion! Would you mind helping me understand what you expect this to do?

I tried removing the file from this module, and still see the same error. From a similar module the lock file looks like

provider "registry.terraform.io/fastly/fastly" {
  version = "0.21.2"
  hashes = [

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.

1 Like

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.