Search code examples
terraformdatabricksazure-databricksterraform-provider-azureterraform-provider-databricks

Terraform Unable to list provider


I am trying to create azure databrick cluster but when i try to run terraform init i see the following error. How can i rectify this. So bascially how to use different provider in terraform. Terraform version is Terraform v0.14.5

When i run terraform init i get the following error

Initializing the backend...

  Initializing provider plugins...
        - Finding hashicorp/azurerm versions matching "~> 2.33"...
        - Finding latest version of hashicorp/databricks...
        - Installing hashicorp/azurerm v2.45.1...
        - Installed hashicorp/azurerm v2.45.1 (signed by HashiCorp)

       Error: Failed to query available provider packages

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

           If you have just upgraded directly from Terraform v0.12 to Terraform v0.14
           then please upgrade to Terraform v0.13 first and follow the upgrade guide for
           that release, which might help you address this problem.

Solution

  • if you specify provider as simply databrics, then it's resolved into the hashicorp namespace (as you can see in the message: Finding latest version of hashicorp/databricks...). To resolve it correctly, you need to put its definition into the required_providers block of Terraform itself, like this (you can copy it from the "USE PROVIDER" button in documentation):

    terraform {
      required_providers {
        databricks = {
          source  = "databrickslabs/databricks"
          version = "0.3.0"
        }
      }
    }