Terraform: Error: Failed to query available provider packages

Created on 18 Aug 2020  ยท  4Comments  ยท  Source: hashicorp/terraform

Terraform Version

Terraform v0.13.0

Terraform Configuration Files

terraform {
  required_version = ">= 0.13"
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "2.23.0"
    }
    databricks = {
      source = "databrickslabs/databricks"
      version = "0.2.3"
    }
    local = {
      source = "hashicorp/local"
    }
    random = {
      source = "hashicorp/random"
    }
  }
}

Debug Output

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider -/databricks:
provider registry registry.terraform.io does not have a provider named
registry.terraform.io/-/databricks

Expected Behavior

terraform init succeed

Actual Behavior

terraform init fails

Steps to Reproduce

  1. terraform init
bug new

All 4 comments

It still happens to me trying to user databricks provider... terraform creates a folder - and copies all its own providers to it, but it doesn't copy other providers, for me its databricks

'-' folder
image

databrickslabs folder
image

workaround... manual copy the folder of the provider to - folder
image

image

Just need to think If you're going to automate this, creating a scripts that copies the folder while this is fixed

Hi @dgonzalezp , thanks for reporting this and I'm sorry you're experiencing this confusing behavior!

Terraform v0.13 pulls a list of providers from both the state and configuration when determining provider requirements - you can run terraform providers to see this in action. Terraform v0.12 has no concept of 'namespaces', so when it encounters a provider named "databricks" it queries a special "alises" table in the registry, which is where that odd-looking "-/databricks" (and other providers) come from. Since that provider is not a hashicorp provider, it's unable to find it.

You can fix this by using the terraform state replace-provider command to update your statefile with the databricks providers' source address :

terraform state replace-provider -/databricks registry.terraform.io/databrickslab/databricks

For anyone else interested in this issue, this information is in the upgrade guide, but rather hard to find in the in-house providers section.

Thanks again, and sorry for the confusion!

Great! Thank you for your answer! @mildwonkey

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronnix picture ronnix  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

rkulagowski picture rkulagowski  ยท  3Comments

sprokopiak picture sprokopiak  ยท  3Comments

franklinwise picture franklinwise  ยท  3Comments