@@ -17,21 +17,49 @@ provider "databricks" {
17
17
}
18
18
19
19
locals {
20
- metastore_id = "10000000-0000-0000-0000-0000000000"
21
-
22
- metastore_grants = [
23
- { principal = "<user1@email.com>", privileges = ["CREATE_CATALOG","CREATE_EXTERNAL_LOCATION"] },
24
- { principal = "<user2@epam.com>", privileges = ["CREATE_SHARE", "CREATE_RECIPIENT", "CREATE_PROVIDER"] }
20
+ catalog_config = [
21
+
22
+ # Catalog w/o grants
23
+ {
24
+ catalog_name = "catalog_with_no_grants"
25
+ },
26
+
27
+ # Catalog with grants
28
+ {
29
+ catalog_name = "catalog_with_grants"
30
+ catalog_grants = [
31
+ { principal = "account users", privileges = ["USE_CATALOG", "APPLY_TAG", "CREATE_SCHEMA", "SELECT"] }
32
+ ]
33
+ },
34
+
35
+ # Catalog with grants and schemas
36
+ {
37
+ catalog_name = "catalog_with_schemas"
38
+ catalog_grants = [{ principal = "account users", privileges = ["USE_CATALOG", "APPLY_TAG", "SELECT"] }]
39
+ schema_configs = [
40
+ { schema_name = "schema_01" },
41
+ { schema_name = "schema_02" }
42
+ ]
43
+ },
44
+
45
+ # Catalog with schemas where 'schema_01' and 'schema_02' have a default set of grants from 'schema_default_grants' parameter
46
+ # and 'schema_03' has its own set of grants managed with 'schema_custom_grants' parameter
47
+ {
48
+ catalog_name = "catalog_custom_schema_grants"
49
+ catalog_grants = [{ principal = "account users", privileges = ["USE_CATALOG", "APPLY_TAG"] }]
50
+ schema_default_grants = [{ principal = "account users", privileges = ["CREATE_TABLE", "SELECT"] }]
51
+ schema_configs = [
52
+ { schema_name = "schema_01" },
53
+ { schema_name = "schema_02" },
54
+ {
55
+ schema_name = "schema_03",
56
+ schema_custom_grants = [
57
+ { principal = "account users", privileges = ["CREATE_VOLUME", "READ_VOLUME", "WRITE_VOLUME", "SELECT"] },
58
+ ]
59
+ },
60
+ ]
61
+ },
25
62
]
26
-
27
- catalog = {
28
- example_catalog = {
29
- catalog_grants = {
30
- "example@username.com" = ["USE_CATALOG", "USE_SCHEMA", "CREATE_SCHEMA", "CREATE_TABLE", "SELECT", "MODIFY"]
31
- }
32
- schema_name = ["raw", "refined", "data_product"]
33
- }
34
- }
35
63
}
36
64
37
65
# Prerequisite module.
@@ -50,12 +78,9 @@ module "metastore_assignment" {
50
78
51
79
module "unity_catalog" {
52
80
source = "data-platform/unity-catalog/databricks"
53
- version = "~> 1.1 .0"
81
+ version = "~> 2.0 .0"
54
82
55
- env = "example"
56
- metastore_id = local.metastore_id
57
- metastore_grants = local.metastore_grants
58
- catalog = local.catalog
83
+ catalog_config = local.catalog_config
59
84
60
85
providers = {
61
86
databricks = databricks.workspace
0 commit comments