|
1 |
| -# Azure <> Terraform module |
2 |
| -Terraform module for creation Azure <> |
| 1 | +# Azure Unity Catalog Terraform module |
| 2 | +Terraform module for creation Azure Unity Catalog |
3 | 3 |
|
4 | 4 | ## Usage
|
| 5 | +```hcl |
| 6 | +# Prerequisite resources |
5 | 7 |
|
| 8 | +# Configure Databricks Provider |
| 9 | +data "azurerm_databricks_workspace" "example" { |
| 10 | + name = "example-workspace" |
| 11 | + resource_group_name = "example-rg" |
| 12 | +} |
| 13 | +
|
| 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 | +
|
| 37 | +locals { |
| 38 | + catalog = { |
| 39 | + example_catalog = { |
| 40 | + catalog_grants = { |
| 41 | + "example@username.com" = ["USE_CATALOG", "USE_SCHEMA", "CREATE_SCHEMA", "CREATE_TABLE", "SELECT", "MODIFY"] |
| 42 | + } |
| 43 | + schema_name = ["raw", "refined", "data_product"] |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | +
|
| 48 | +module "unity_catalog" { |
| 49 | + source = "../environment/modules/unity" |
| 50 | +
|
| 51 | + project = "datahq" |
| 52 | + env = "example" |
| 53 | + location = "eastus" |
| 54 | + access_connector_id = azurerm_databricks_access_connector.example.id |
| 55 | + storage_account_id = data.azurerm_storage_account.example.id |
| 56 | + storage_account_name = data.azurerm_storage_account.example.name |
| 57 | + catalog = local.catalog |
| 58 | +
|
| 59 | + providers = { |
| 60 | + databricks = databricks.main |
| 61 | + } |
| 62 | +} |
| 63 | +``` |
6 | 64 | <!-- BEGIN_TF_DOCS -->
|
| 65 | +## Requirements |
| 66 | + |
| 67 | +| Name | Version | |
| 68 | +| ------------------------------------------------------------------------- | --------- | |
| 69 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 | |
| 70 | +| <a name="requirement_databricks"></a> [databricks](#requirement\_databricks) | >= 1.14.2 | |
| 71 | +| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.40.0 | |
| 72 | + |
| 73 | +## Providers |
| 74 | + |
| 75 | +| Name | Version | |
| 76 | +| ------------------------------------------------------------- | --------- | |
| 77 | +| <a name="provider_databricks"></a> [databricks](#provider\_databricks) | 1.14.2 | |
| 78 | +| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.40.0 | |
| 79 | + |
| 80 | +## Modules |
| 81 | + |
| 82 | +No modules. |
| 83 | + |
| 84 | +## Resources |
| 85 | + |
| 86 | +| Name | Type | |
| 87 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | |
| 88 | +| [azurerm_storage_data_lake_gen2_filesystem.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_data_lake_gen2_filesystem) | resource | |
| 89 | +| [databricks_metastore.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/metastore) | resource | |
| 90 | +| [databricks_grants.metastore](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/grants) | resource | |
| 91 | +| [databricks_metastore_data_access.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/metastore_data_access) | resource | |
| 92 | +| [databricks_catalog.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/catalog) | resource | |
| 93 | +| [databricks_grants.catalog](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/grants) | resource | |
| 94 | +| [databricks_schema.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/sql_endpoint) | resource | |
| 95 | +| [databricks_grants.schema](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/schema) | resource | |
| 96 | + |
| 97 | +## Inputs |
| 98 | + |
| 99 | +| Name | Description | Type | Default | Required | |
| 100 | +| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -------------- | ------- | :------: | |
| 101 | +| <a name="input_project"></a> [project](#input\_project) | Project name | `string` | n/a | yes | |
| 102 | +| <a name="input_env"></a> [env](#input\_env) | Environment name | `string` | n/a | yes | |
| 103 | +| <a name="input_location"></a> [location](#input\_location) | Azure location | `string` | n/a | yes | |
| 104 | +| <a name="input_suffix"></a> [suffix](#input\_suffix) | Optional suffix that would be added to the end of resources names. | `string` | " " | no | |
| 105 | +| <a name="input_create_metastore"></a> [create\_metastore](#input\_create\_metastore) | Boolean flag for Unity Catalog Metastore current in this environment. One Metastore per region | `bool` | true | no | |
| 106 | +| <a name="input_access_connector_id"></a> [access\_connector\_id](#input\_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 | |
| 107 | +| <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 | |
| 108 | +| <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 | |
| 109 | +| <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 | |
| 110 | +| <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 | |
| 111 | +| <a name="input_metastore_grants"></a> [metastore\_grants](#input\_metastore\_grants) | Permissions to give on metastore to group | `map(list(string))` | {} | no | |
| 112 | +| <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 | |
| 113 | + |
| 114 | +## Outputs |
7 | 115 |
|
| 116 | +| Name | Description | |
| 117 | +| -------------------------------------------------------------------------- | -------------------------------------- | |
| 118 | +| <a name="output_metastore_id"></a> [metastore\_id](#output\_metastore\_id) | Unity Catalog Metastore Id. | |
| 119 | +| <a name="output_data_lake_gen2_file_system_id"></a> [data\_lake\_gen2\_file\_syste_id](#output\_data\_lake\_gen2\_file\_syste_id) | The ID of the Data Lake Gen2 File System. | |
8 | 120 | <!-- END_TF_DOCS -->
|
9 | 121 |
|
10 | 122 | ## License
|
11 | 123 |
|
12 |
| -Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-azurerm<>/tree/master/LICENSE) |
| 124 | +Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-databricks-unity-catalog/tree/master/LICENSE) |
0 commit comments