Terraform module for creation Databricks External Location
# Prerequisite resources
# Databricks Workspace with Premium SKU
data "azurerm_databricks_workspace" "example" {
name = "example-workspace"
resource_group_name = "example-rg"
}
resource "azurerm_databricks_access_connector" "example" {
name = "example-resource"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
identity {
type = "SystemAssigned"
}
}
# Databricks Provider configuration
provider "databricks" {
alias = "main"
host = data.azurerm_databricks_workspace.example.workspace_url
azure_workspace_resource_id = data.azurerm_databricks_workspace.example.id
}
locals {
storage_credentials = {
prefix = "example"
azure_access_connector_id = azurerm_databricks_access_connector.example.id
permissions = [{ principal = "ALL_PRIVILEGES_GROUP", privileges = ["ALL_PRIVILEGES"] }]
}
external_locations =
{
name = "adls-example"
url = "abfss://container@storageaccount.dfs.core.windows.net"
permissions = [
{ principal = "ALL_PRIVILEGES_GROUP", privileges = ["ALL_PRIVILEGES"] },
{ principaprincipal = "EXAMPLE_PERMISSION_GROUP", privileges = ["CREATE_EXTERNAL_TABLE", "READ_FILES"] }
]
owner = "username@domain.com"
skip_validation = true
read_only = false
comment = "example_comment"
}
}
# Databricks External Location
module "databricks_locations" {
count = var.databricks_configure ? (module.databricks_workspace.sku == "premium" ? 1 : 0) : 0
source = "data-platform-hq/external-location/databricks"
version = "~> 1.0"
project = "datahq"
env = "example"
location = "eastus"
storage_credential = local.storage_credentials
external_locations = local.external_locations
providers = {
databricks = databricks.workspace
}
}
Name | Version |
---|---|
terraform | >=1.0.0 |
azurerm | >= 4.0.1 |
databricks | ~>1.0 |
Name | Version |
---|---|
databricks | ~>1.0 |
No modules.
Name | Type |
---|---|
databricks_external_location.this | resource |
databricks_grants.credential | resource |
databricks_grants.locations | resource |
databricks_storage_credential.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
external_locations | List of object with external location configuration attributes | list(object({ |
[] |
no |
storage_credential | Object with storage credentials configuration attributes | object({ |
n/a | yes |
Name | Description |
---|---|
databricks_gcp_service_account | The email of the GCP service account created, to be granted access to relevant buckets |
external_locations | Map of objects with External Location parameters, like name, credentials name and url of target storage |
storage_credential_metastore_id | Storage Credential metastore id |
storage_credential_name | Storage Credential name |
Apache 2 Licensed. For more information please see LICENSE