Skip to content

Commit df4c57e

Browse files
author
oleh_mykolaishyn
committed
docs: readme example
1 parent d1f4a59 commit df4c57e

File tree

1 file changed

+44
-19
lines changed

1 file changed

+44
-19
lines changed

README.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,49 @@ provider "databricks" {
1717
}
1818
1919
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+
},
2562
]
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-
}
3563
}
3664
3765
# Prerequisite module.
@@ -50,12 +78,9 @@ module "metastore_assignment" {
5078
5179
module "unity_catalog" {
5280
source = "data-platform/unity-catalog/databricks"
53-
version = "~> 1.1.0"
81+
version = "~> 2.0.0"
5482
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
5984
6085
providers = {
6186
databricks = databricks.workspace

0 commit comments

Comments
 (0)