cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

cannot create external location: invalid Databricks Workspace configuration

manoj_2355ca
New Contributor III

HI All

I am trying to create databricks storage credentials , external location and catalog with terraform.

cloud : Azure

My storage credentials code is working correctly . But the external location code is throwing below error when executing the Terraform apply .

│ Error: cannot create external location: invalid Databricks Workspace configuration

│ with module.dbs_external_location.databricks_external_location.int_exl["prod"],
│ on ..\modules\dbs_external_location\exl_main.tf line 1, in resource "databricks_external_location" "int_exl":
│ 1: resource "databricks_external_location" "int_exl" {

can anyone please help me on this 

 

3 REPLIES 3

Kaniz_Fatma
Community Manager
Community Manager

Hi @manoj_2355ca,

 

Workspace URL: Ensure that the workspace URL is correct and accessible. It should be something like https://<workspace-name>.azuredatabricks.net.

Personal Access Token: The personal access token used for authentication might be invalid or expired. You can generate a new token from the Databricks workspace.

Configuration Parameters: Check the configuration parameters of the databricks_external_location resource in your Terraform script. Make sure they are correctly set.

manoj_2355ca
New Contributor III

HI @Kaniz_Fatma

Thanks for the reply . Even after correcting my databricks workspace provider configuration . I am not able to create 3 external location in databricks workspace.
i am using below code in terraform .
Provider .tf 

 

provider "databricks" {
  alias = "wrkshp"
  host = ""
  token = ""
 
in module file :
resource "databricks_external_location" "exl_dbs" {

  for_each = var.exl_name


  name = each.value["name"]

  url = each.value["url"]
  credential_name = var.storage_cred


  comment         = each.value["comment"]
  metastore_id = var.metid
 
in module terraform tf :
terraform {
  required_providers {
    databricks = {
      source  = "databricks/databricks"
      version = ">=1.33.0"
      configuration_aliases = [ databricks.wrkshp ]
    }
  }
}
 
in module variable tf:
variable "exl_name" {
  type = map(object({
    name = string
    url = string
    #credential_name = string
    comment = string
    metastore_id = string
  }))
  default = {
    "dev" = {
      name = ""
      url = ""
      #credential_name = ""
      comment = "Managed by Tf"
      metastore_id = ""      
    }
    "prod" = {
      name = ""
      url = ""
      #credential_name = ""
      comment = "Managed by TF"
      metastore_id = ""
    }
    "uat" = {
      name = ""
      url = ""
      #credential_name = ""
      comment = "Managed by TF"
      metastore_id = ""
    }
  }  
}

variable "storage_cred" {
  type = string
  default = ""
 
}

variable "metid" {
  type =  string
  default = ""
}
 
and in main module file :: 
module "dbs_external_location"  {
    source = "../modules/dbs_external_location"

    exl_name = var.exl_name
    storage_cred = module.dbs_storage_creds.storage_credential_id
    metid = data.databricks_metastore.int_meta.metastore_id

    providers = {

        databricks.wrkshp = databricks.wrkshp
    }
 
}
 
This is failing with below error . Not sure what is wrong .
 
module.dbs_external_location.databricks_external_location.exl_dbs["dev"]: Creating...
module.dbs_external_location.databricks_external_location.exl_dbs["prod"]: Creating...
module.dbs_external_location.databricks_external_location.exl_dbs["uat"]: Creating...

│ Error: cannot create external location: invalid Databricks Workspace configuration

│ with module.dbs_external_location.databricks_external_location.exl_dbs["prod"],
│ on ..\modules\dbs_external_location\exl_main.tf line 1, in resource "databricks_external_location" "exl_dbs":
│ 1: resource "databricks_external_location" "exl_dbs" {



│ Error: cannot create external location: invalid Databricks Workspace configuration

│ with module.dbs_external_location.databricks_external_location.exl_dbs["dev"],
│ on ..\modules\dbs_external_location\exl_main.tf line 1, in resource "databricks_external_location" "exl_dbs":
│ 1: resource "databricks_external_location" "exl_dbs" {



│ Error: cannot create external location: invalid Databricks Workspace configuration

│ with module.dbs_external_location.databricks_external_location.exl_dbs["uat"],
│ on ..\modules\dbs_external_location\exl_main.tf line 1, in resource "databricks_external_location" "exl_dbs":
│ 1: resource "databricks_external_location" "exl_dbs" {
 
can anyone help me on this .
 



Hi @manoj_2355ca, The error message you’re seeing indicates that there’s an issue with the Databricks Workspace configuration. 

 

Workspace Configuration: Ensure that the host and token in your provider configuration are correctly set. The host should be the URL of your Databricks workspace, and the token should be a valid personal ac...n.

 

Dependency on Workspace Creation: If your workspace is being created as part of your Terraform scrip....

 

Provider Version: Ensure that you’re using a compatible version of the Databricks provider. The error could be due to a bug in the provider version you’re using.

 

Permissions: Check if the token used has the necessary permissions to create an external location.

 

Remember to redact any sensitive information when sharing your code.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group