cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Having an issue assigning databricks_current_metastore with terraform provider

badari_narayan
New Contributor II

I am trying to assign my databricks_current_metastore on terraform and I get the following error back as an output 

Error: cannot read current metastore: cannot get client current metastore: invalid Databricks Workspace configuration

with data.databricks_current_metastore.this,

on main.tf line 23, in data "databricks_current_metastore" "this":

 23: data "databricks_current_metastore" "this"{

 

data "databricks_current_metastore" "this"{

  provider = databricks.accounts

  depends_on = [ data.azurerm_databricks_workspace.workspace ]

}

provider "databricks" {

  alias = "workspace"

  azure_client_id     = var.client_id

  azure_client_secret = var.client_secret

  azure_tenant_id     = var.tenant_id

  host                = data.azurerm_databricks_workspace.workspace.workspace_url

}

 

provider "azurerm" {

  client_id       = var.client_id

  client_secret   = var.client_secret

  tenant_id       = var.tenant_id

  subscription_id = var.subscription_id

  features {}

}

provider "databricks" {

    alias = "accounts"

    host =  "https://accounts.azuredatabricks.net"

    account_id = var.account_id

}

Can you help me to resolve this issue

1 REPLY 1

Panda
Valued Contributor

@badari_narayan Based on above terraform code, you are trying to use the databricks.accounts provider to read the current workspace metastore, which is incorrect — the databricks_current_metastore data source is a workspace-level resource, and must be used with the workspace-level provider.

Review the Terraform documentation for the same
https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/metastore