|
2 | 2 | Terraform module used for Databricks Workspace configuration and Resources creation
|
3 | 3 |
|
4 | 4 | ## Usage
|
5 |
| - |
| 5 | +This module provides an ability for Databricks Workspace configuration and Resources creation, for example: |
| 6 | +1. Default Shared Autoscaling cluster |
| 7 | +2. ADLS Gen2 Mount |
| 8 | +3. Secret scope and its secrets |
| 9 | +4. Cluster policies |
| 10 | +5. Users for Standard SKU Worspaces |
| 11 | + |
| 12 | +```hcl |
| 13 | +# Prerequisite resources |
| 14 | +data "azurerm_databricks_workspace" "example" { |
| 15 | + name = "example-workspace" |
| 16 | + resource_group_name = "example-rg" |
| 17 | +} |
| 18 | +
|
| 19 | +# Databricks Provider configuration |
| 20 | +provider "databricks" { |
| 21 | + alias = "main" |
| 22 | + host = data.azurerm_databricks_workspace.example.workspace_url |
| 23 | + azure_workspace_resource_id = data.azurerm_databricks_workspace.example.id |
| 24 | +} |
| 25 | +
|
| 26 | +# Key Vault which contains Service Principal credentials (App ID and Secret) for mounting ADLS Gen 2 |
| 27 | +data "azurerm_key_vault" "example" { |
| 28 | + name = "example-key-vault" |
| 29 | + resource_group_name = "example-rg" |
| 30 | +} |
| 31 | +
|
| 32 | +data "azurerm_storage_account" "example" { |
| 33 | + name = "examplestorage" |
| 34 | + resource_group_name = "example-rg" |
| 35 | +} |
| 36 | +
|
| 37 | +# Databricks Runtime module usage example |
| 38 | +module "databricks_runtime_core" { |
| 39 | + source = "data-platform-hq/databricks-runtime/databricks" |
| 40 | +
|
| 41 | + sku = "premium" |
| 42 | + workspace_id = data.azurerm_databricks_workspace.example.workspace_id |
| 43 | + |
| 44 | + # This parameter only used when workspace wku equals 'standard' |
| 45 | + users = ["user1", "user2"] |
| 46 | +
|
| 47 | + # Parameters of Service principal used for ADLS mount |
| 48 | + # Imports App ID and Secret of Service Principal from target Key Vault |
| 49 | + key_vault_id = data.azurerm_key_vault.example.id |
| 50 | + sp_client_id_secret_name = "sp-client-id" # secret's name that stores Service Principal App ID |
| 51 | + sp_key_secret_name = "sp-key" # secret's name that stores Service Principal Secret Key |
| 52 | + tenant_id_secret_name = "infra-arm-tenant-id" # secret's name that stores tenant id value |
| 53 | +
|
| 54 | + # Default cluster parameters |
| 55 | + custom_default_cluster_name = "databricks_example_custer" |
| 56 | + cluster_nodes_availability = "SPOT_AZURE" # it required to increase Regional Spot quotas |
| 57 | + cluster_log_conf_destination = "dbfs:/cluster-logs" |
| 58 | + custom_cluster_policies = [{ |
| 59 | + name = "custom_policy_1", |
| 60 | + assigned = true, |
| 61 | + can_use = null, |
| 62 | + definition = { |
| 63 | + "autoscale.max_workers": { |
| 64 | + "type": "range", |
| 65 | + "maxValue": 3, |
| 66 | + "defaultValue": 2 |
| 67 | + }, |
| 68 | + } |
| 69 | + }] |
| 70 | +
|
| 71 | + # Additional Secret Scope |
| 72 | + secret_scope = [{ |
| 73 | + scope_name = "extra-scope" |
| 74 | + acl = null # Only group names are allowed. If left empty then only Workspace admins could access these keys |
| 75 | + secrets = [ |
| 76 | + { key = "secret-name", string_value = "secret-value"} |
| 77 | + ] |
| 78 | + }] |
| 79 | +
|
| 80 | + mountpoints = { |
| 81 | + storage_account_name = data.azurerm_storage_account.example.name |
| 82 | + container_name = "example_container" |
| 83 | + } |
| 84 | +
|
| 85 | + providers = { |
| 86 | + databricks = databricks.main |
| 87 | + } |
| 88 | +} |
| 89 | +``` |
6 | 90 | <!-- BEGIN_TF_DOCS -->
|
7 | 91 | ## Requirements
|
8 | 92 |
|
|
0 commit comments