Terraform module for creation Databricks Unity Catalog
This module manages Unity Catalog resources like Catalogs, Schemas. In addition, it is possible to manage permissions within Metastore, Catalog and Schemas.
# Configure Databricks Provider
data "azurerm_databricks_workspace" "example" {
name = "example-workspace"
resource_group_name = "example-rg"
}
provider "databricks" {
alias = "workspace"
host = data.databricks_workspace.example.workspace_url
azure_workspace_resource_id = data.databricks_workspace.example.id
}
locals {
catalog_config = [
# Catalog w/o grants
{
catalog_name = "catalog_with_no_grants"
},
# Catalog with grants
{
catalog_name = "catalog_with_grants"
catalog_grants = [
{ principal = "account users", privileges = ["USE_CATALOG", "APPLY_TAG", "CREATE_SCHEMA", "SELECT"] }
]
},
# Catalog with grants and schemas
{
catalog_name = "catalog_with_schemas"
catalog_grants = [{ principal = "account users", privileges = ["USE_CATALOG", "APPLY_TAG", "SELECT"] }]
schema_configs = [
{ schema_name = "schema_01" },
{ schema_name = "schema_02" }
]
},
# Catalog with schemas where 'schema_01' and 'schema_02' have a default set of grants from 'schema_default_grants' parameter
# and 'schema_03' has its own set of grants managed with 'schema_custom_grants' parameter
{
catalog_name = "catalog_custom_schema_grants"
catalog_grants = [{ principal = "account users", privileges = ["USE_CATALOG", "APPLY_TAG"] }]
schema_default_grants = [{ principal = "account users", privileges = ["CREATE_TABLE", "SELECT"] }]
schema_configs = [
{ schema_name = "schema_01" },
{ schema_name = "schema_02" },
{
schema_name = "schema_03",
schema_custom_grants = [
{ principal = "account users", privileges = ["CREATE_VOLUME", "READ_VOLUME", "WRITE_VOLUME", "SELECT"] },
]
},
]
},
]
}
module "unity_catalog" {
source = "data-platform/unity-catalog/databricks"
version = "~> 2.0.0"
catalog_config = local.catalog_config
providers = {
databricks = databricks.workspace
}
depends_on = [module.metastore_assignment]
}
Name | Version |
---|---|
terraform | >=1.0.0 |
databricks | ~>1.0 |
Name | Version |
---|---|
databricks | ~>1.0 |
No modules.
Name | Type |
---|---|
databricks_catalog.this | resource |
databricks_grants.catalog | resource |
databricks_grants.schema | resource |
databricks_schema.this | resource |
databricks_workspace_binding.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
catalog_config | list(object({ |
[] |
no | |
isolated_unmanaged_catalog_bindings | list(object({ |
[] |
no | |
workspace_id | ID of the target workspace. | string |
null |
no |
No outputs.
Apache 2 Licensed. For more information please see LICENSE