I am trying to create databricks metastore using Terraform by following documentation.
I tried below code:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.74.0"
}
databricks = {
source = "databricks/databricks"
}
}
}
provider "databricks" {
profile = var.databricks_connection_profile (DEFAULT conn profile was valid)
host = data.azurerm_databricks_workspace.dbwdata.workspace_url
#token= "*****" (I tried this)
#config_file = <path of .databrickscfg> (& this as well)
}
resource "databricks_metastore" "this" {
provider = databricks.accounts
name = "mymeta"
storage_root = format("abfss://%s@%s.dfs.core.windows.net/sandbox",
"container",
"samplestorage")
force_destroy = true
region = var.azure_region
depends_on = [
module.databricks
]
}
But I am getting below error:
Error: cannot create metastore: Invalid JSON received (1040 bytes): <!doctype html>Databricks - Sign inYou need to enable JavaScript to run this app.
The error message you're encountering suggests an issue related to authentication or access to the
Databricks
environment. Make sure it has the required permissions for theService Principal
(Account Admin) to create aMeta Store
. follow the Ms doc about assigningaccount admin
to SP.Here is the updated code to create
Metastore
usingService Principal
Terraform apply:
After running the code, the meta store has been created in workspace as below.