Terraform registry does not have a provider error

You cannot install the Databricks Terraform provider if the required_providers block is not defined in your modules.

Written by prabakar.ammeappin

Last published at: August 16th, 2022

Problem

You are installing the Databricks Terraform provider (AWS | Azure | GCP) and get a Databricks provider registry error.

Error while installing hashicorp/databricks: provider registry
registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/databricks

Cause

This error occurs when the required_providers block is not defined in every module that uses the Databricks Terraform provider.

Solution

Create a versions.tf file with the following contents:

# versions.tf
terraform {
  required_providers {
    databricks = {
      source  = "databricks/databricks"
      version = "1.0.0"
    }
  }
}

Save a copy of this version.tf file in every module in the environments level of your code base.

Remove the version field from the versions.tf file and save a copy of the updated file in every module in the modules level of your code base.

For example:

├── environments
│   ├── sandbox
│   │   ├── README.md
│   │   ├── main.tf
│   │   └── versions.tf   // This file contains the "version" field.
│   └── production
│       ├── README.md
│       ├── main.tf
│       └── versions.tf   // This file contains the "version" field.
└── modules
    ├── first-module
    │   ├── ...
    │   └── versions.tf   // This file does NOT contain the "version" field.
    └── second-module
        ├── ...
        └── versions.tf   // This file does NOT contain the "version" field.


Review the Requiring providers Terraform documentation for more information.

Was this article helpful?