Terraform module for creation Azure Unity Catalog
# Prerequisite resources
# Configure Databricks Provider
data "azurerm_databricks_workspace" "example" {
name = "example-workspace"
resource_group_name = "example-rg"
}
provider "databricks" {
alias = "main"
host = data.databricks_workspace.example.workspace_url
azure_workspace_resource_id = data.databricks_workspace.example.id
}
# Databricks Access Connector (managed identity)
resource "azurerm_databricks_access_connector" "example" {
name = "example-resource"
resource_group_name = "example-rg"
location = "eastus"
identity {
type = "SystemAssigned"
}
}
# Storage Account
data "azurerm_storage_account" "example" {
name = "example-storage-account"
resource_group_name = "example-rg"
}
locals {
catalog = {
example_catalog = {
catalog_grants = {
"example@username.com" = ["USE_CATALOG", "USE_SCHEMA", "CREATE_SCHEMA", "CREATE_TABLE", "SELECT", "MODIFY"]
}
schema_name = ["raw", "refined", "data_product"]
}
}
}
module "unity_catalog" {
source = "../environment/modules/unity"
project = "datahq"
env = "example"
location = "eastus"
access_connector_id = azurerm_databricks_access_connector.example.id
storage_account_id = data.azurerm_storage_account.example.id
storage_account_name = data.azurerm_storage_account.example.name
catalog = local.catalog
providers = {
databricks = databricks.main
}
}| Name | Version |
|---|---|
| terraform | >= 1.0.0 |
| databricks | >= 1.14.2 |
| azurerm | >= 3.40.0 |
| Name | Version |
|---|---|
| databricks | 1.14.2 |
| azurerm | 3.40.0 |
No modules.
| Name | Type |
|---|---|
| azurerm_storage_data_lake_gen2_filesystem.this | resource |
| databricks_metastore.this | resource |
| databricks_grants.metastore | resource |
| databricks_metastore_data_access.this | resource |
| databricks_catalog.this | resource |
| databricks_grants.catalog | resource |
| databricks_schema.this | resource |
| databricks_grants.schema | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| project | Project name | string |
n/a | yes |
| env | Environment name | string |
n/a | yes |
| location | Azure location | string |
n/a | yes |
| suffix | Optional suffix that would be added to the end of resources names. | string |
" " | no |
| create_metastore | Boolean flag for Unity Catalog Metastore current in this environment. One Metastore per region | bool |
true | no |
| access_connector_id | Databricks Access Connector Id that lets you to connect managed identities to an Azure Databricks account. Provides an ability to access Unity Catalog with assigned identity | string |
" " | no |
| storage_account_id | Storage Account Id where Unity Catalog Metastore would be provisioned | string |
" " | no |
| storage_account_name | Storage Account Name where Unity Catalog Metastore would be provisioned | string |
" " | no |
| external_metastore_id | Unity Catalog Metastore Id that is located in separate environment. Provide this value to associate Databricks Workspace with target Metastore | string |
" " | no |
| catalog | Map of objects which parameters refers to certain catalog and schema attributes | map(object({ |
{} | no |
| metastore_grants | Permissions to give on metastore to group | map(list(string)) |
{} | no |
| custom_databricks_metastore_name | The name to provide for your Databricks Metastore | string |
null | no |
| Name | Description |
|---|---|
| metastore_id | Unity Catalog Metastore Id. |
| data_lake_gen2_file_syste_id | The ID of the Data Lake Gen2 File System. |
Apache 2 Licensed. For more information please see LICENSE