Skip to content

Commit ffe8a2e

Browse files
authored
docs: updated example
1 parent 0978f74 commit ffe8a2e

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

README.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,46 @@
22
Terraform module for creation Azure Unity Catalog
33

44
## Usage
5-
6-
### below is an example of creating a Unit Catalog
7-
85
```hcl
96
# Prerequisite resources
107
11-
# Storage Account with ADLS Gen2
12-
data "azurerm_storage_account" "example" {
8+
# Configure Databricks Provider
9+
data "azurerm_databricks_workspace" "example" {
1310
name = "example-workspace"
1411
resource_group_name = "example-rg"
1512
}
1613
14+
provider "databricks" {
15+
alias = "main"
16+
host = data.databricks_workspace.example.workspace_url
17+
azure_workspace_resource_id = data.databricks_workspace.example.id
18+
}
19+
20+
# Databricks Access Connector (managed identity)
21+
resource "azurerm_databricks_access_connector" "example" {
22+
name = "example-resource"
23+
resource_group_name = "example-rg"
24+
location = "eastus"
25+
26+
identity {
27+
type = "SystemAssigned"
28+
}
29+
}
30+
31+
# Storage Account
32+
data "azurerm_storage_account" "example" {
33+
name = "example-storage-account"
34+
resource_group_name = "example-rg"
35+
}
36+
1737
locals {
18-
catalog = {
19-
example_catalog = {
20-
catalog_grants = {
21-
"example@username.com" = ["USE_CATALOG", "USE_SCHEMA", "CREATE_SCHEMA", "CREATE_TABLE", "SELECT", "MODIFY"]
22-
}
23-
}
38+
catalog = {
39+
example_catalog = {
40+
catalog_grants = {
41+
"example@username.com" = ["USE_CATALOG", "USE_SCHEMA", "CREATE_SCHEMA", "CREATE_TABLE", "SELECT", "MODIFY"]
42+
}
2443
}
44+
}
2545
}
2646
2747
module "unity_catalog" {
@@ -30,7 +50,7 @@ module "unity_catalog" {
3050
project = "datahq"
3151
env = "example"
3252
location = "eastus"
33-
access_connector_id = var.access_connector_enabled ? module.databricks_workspace.access_connector_id : null
53+
access_connector_id = azurerm_databricks_access_connector.example.id
3454
storage_account_id = data.azurerm_storage_account.example.id
3555
storage_account_name = data.azurerm_storage_account.example.name
3656
catalog = local.catalog
@@ -86,7 +106,7 @@ No modules.
86106
| <a name="input_storage_account_id"></a> [storage\_account\_id](#input\_storage\_account\_id) | Storage Account Id where Unity Catalog Metastore would be provisioned | `string` | " " | no |
87107
| <a name="input_storage_account_name"></a> [storage\_account\_name](#input\_storage\_account\_name) | Storage Account Name where Unity Catalog Metastore would be provisioned | `string` | " " | no |
88108
| <a name="input_external_metastore_id"></a> [external\_metastore\_id](#input\_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 |
89-
| <a name="input_catalog"></a> [catalog](#input\_catalog) | Map of SQL Endpoints to be deployed in Databricks Workspace | <pre> map(object({ <br> catalog_grants = optional(map(list(string))) <br> catalog_comment = optional(string) <br> catalog_properties = optional(map(string)) <br> schema_name = optional(list(string)) <br> schema_grants = optional(map(list(string))) <br> schema_comment = optional(string) <br> schema_properties = optional(map(string))<br>})) </pre> | {} | no |
109+
| <a name="input_catalog"></a> [catalog](#input\_catalog) | Map of objects which parameters refers to certain catalog and schema attributes | <pre> map(object({ <br> catalog_grants = optional(map(list(string))) <br> catalog_comment = optional(string) <br> catalog_properties = optional(map(string)) <br> schema_name = optional(list(string)) <br> schema_grants = optional(map(list(string))) <br> schema_comment = optional(string) <br> schema_properties = optional(map(string))<br>})) </pre> | {} | no |
90110
| <a name="input_metastore_grants"></a> [metastore\_grants](#input\_metastore\_grants) | Permissions to give on metastore to group | `map(list(string))` | {} | no |
91111
| <a name="input_custom_databricks_metastore_name"></a> [custom\_databricks\_metastore\_name](#input\_custom\_databricks\_metastore\_name) | The name to provide for your Databricks Metastore | `string` | null | no |
92112

0 commit comments

Comments
 (0)