Skip to content

Commit 0a3a93d

Browse files
authored
Merge pull request #16 from data-platform-hq/feat/module_usage
fix: module usage example
2 parents ee7e70e + 7bff4ba commit 0a3a93d

File tree

1 file changed

+85
-1
lines changed

1 file changed

+85
-1
lines changed

README.md

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,91 @@
22
Terraform module used for Databricks Workspace configuration and Resources creation
33

44
## 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+
```
690
<!-- BEGIN_TF_DOCS -->
791
## Requirements
892

0 commit comments

Comments
 (0)