2
2
3
3
This module allows managing [ Data Catalog Tag Templates] ( https://cloud.google.com/data-catalog/docs/tags-and-tag-templates ) .
4
4
5
- ## Examples
5
+ <!-- BEGIN TOC -->
6
+ - [ Simple Tag Template] ( #simple-tag-template )
7
+ - [ Tag Template with IAM] ( #tag-template-with-iam )
8
+ - [ Factory] ( #factory )
9
+ - [ Variables] ( #variables )
10
+ - [ Outputs] ( #outputs )
11
+ <!-- END TOC -->
6
12
7
- ### Simple Tag Template
13
+ ## Simple Tag Template
8
14
9
15
``` hcl
10
16
module "data-catalog-tag-template" {
11
17
source = "./fabric/modules/data-catalog-tag-template"
12
18
project_id = "my-project"
19
+ region = "europe-west1"
13
20
tag_templates = {
14
21
demo_var = {
15
- region = "europe-west1"
16
22
display_name = "Demo Tag Template"
17
23
fields = {
18
24
source = {
19
25
display_name = "Source of data asset"
26
+ is_required = true
20
27
type = {
21
28
primitive_type = "STRING"
22
29
}
23
- is_required = true
24
30
}
25
31
}
26
32
}
@@ -29,142 +35,68 @@ module "data-catalog-tag-template" {
29
35
# tftest modules=1 resources=1
30
36
```
31
37
32
- ### Tag Template with IAM
38
+ ## Tag Template with IAM
33
39
34
- ``` hcl
35
- module "data-catalog-tag-template" {
36
- source = "./fabric/modules/data-catalog-tag-template"
37
- project_id = "my-project"
38
- tag_templates = {
39
- demo_var = {
40
- region = "europe-west1"
41
- display_name = "Demo Tag Template"
42
- fields = {
43
- source = {
44
- display_name = "Source of data asset"
45
- type = {
46
- primitive_type = "STRING"
47
- }
48
- is_required = true
49
- }
50
- }
51
- }
52
- }
53
- iam = {
54
- "roles/datacatalog.tagTemplateOwner" = ["group:[email protected] "]
55
- "roles/datacatalog.tagTemplateUser" = ["group:[email protected] "]
56
- }
57
- }
58
- # tftest modules=1 resources=3
59
- ```
40
+ The module conforms to our standard IAM interface and implements the ` iam ` , ` iam_bindings ` and ` iam_bindings_additive ` variables.
60
41
61
42
``` hcl
62
43
module "data-catalog-tag-template" {
63
44
source = "./fabric/modules/data-catalog-tag-template"
64
- project_id = var.project_id
65
- tag_templates = {
66
- demo_var = {
67
- region = "europe-west1"
68
- display_name = "Demo Tag Template"
69
- fields = {
70
- source = {
71
- display_name = "Source of data asset"
72
- type = {
73
- primitive_type = "STRING"
74
- }
75
- is_required = true
76
- }
77
- }
78
- }
79
- }
80
- iam_bindings = {
81
- admin-with-delegated_roles = {
82
- role = "roles/datacatalog.tagTemplateOwner"
83
- members = ["group:[email protected] "]
84
- condition = {
85
- title = "delegated-role-grants"
86
- expression = format(
87
- "api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).hasOnly([%s])",
88
- join(",", formatlist("'%s'",
89
- [
90
- "roles/datacatalog.tagTemplateOwner"
91
- ]
92
- ))
93
- )
94
- }
95
- }
96
- }
97
- }
98
- # tftest modules=1 resources=2
99
- ```
100
-
101
- ``` hcl
102
- module "data-catalog-tag-template" {
103
- source = "./fabric/modules/data-catalog-tag-template"
104
- project_id = var.project_id
45
+ project_id = "my-project"
46
+ region = "europe-west1"
105
47
tag_templates = {
106
48
demo_var = {
107
- region = "europe-west1"
108
49
display_name = "Demo Tag Template"
50
+ is_required = true
109
51
fields = {
110
52
source = {
111
53
display_name = "Source of data asset"
112
54
type = {
113
55
primitive_type = "STRING"
114
56
}
115
- is_required = true
116
57
}
117
58
}
118
- }
119
- }
120
- iam_bindings_additive = {
121
- admin-with-delegated_roles = {
122
- role = "roles/datacatalog.tagTemplateOwner"
123
- member = "group:[email protected] "
124
- condition = {
125
- title = "delegated-role-grants"
126
- expression = format(
127
- "api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).hasOnly([%s])",
128
- join(",", formatlist("'%s'",
129
- [
130
- "roles/datacatalog.tagTemplateOwner"
131
- ]
132
- ))
133
- )
59
+ iam = {
60
+ "roles/datacatalog.tagTemplateOwner" = [
61
+
62
+ ]
63
+ "roles/datacatalog.tagTemplateUser" = [
64
+
65
+ ]
134
66
}
135
67
}
136
68
}
137
69
}
138
- # tftest modules=1 resources=2
70
+ # tftest modules=1 resources=3
139
71
```
140
72
141
- ### Factory
73
+ ## Factory
142
74
143
75
Similarly to other modules, a rules factory (see [ Resource Factories] ( ../../blueprints/factories/ ) ) is also included here to allow tag template management via descriptive configuration files.
144
76
145
- Factory configuration is via one optional attributes in the ` factory_config_path ` variable specifying the path where tag template files are stored.
77
+ Factory configuration is done via a single optional attribute in the ` factory_config_path ` variable specifying the path where tag template files are stored.
146
78
147
- Factory tag templates are merged with rules declared in code, with the latter taking precedence where both use the same key.
79
+ Factory tag templates are merged with rules declared in code, with the latter taking precedence if both use the same key.
148
80
149
- The name of the file will be used as ` tag_template_id ` field.
81
+ The name of the file will be used as the ` tag_template_id ` field.
150
82
151
83
This is an example of a simple factory:
152
84
153
85
``` hcl
154
86
module "data-catalog-tag-template" {
155
87
source = "./fabric/modules/data-catalog-tag-template"
156
88
project_id = "my-project"
89
+ region = "europe-west1"
157
90
tag_templates = {
158
91
demo_var = {
159
- region = "europe-west1"
160
92
display_name = "Demo Tag Template"
161
93
fields = {
162
94
source = {
163
95
display_name = "Source of data asset"
96
+ is_required = true
164
97
type = {
165
98
primitive_type = "STRING"
166
99
}
167
- is_required = true
168
100
}
169
101
}
170
102
}
@@ -179,18 +111,17 @@ module "data-catalog-tag-template" {
179
111
``` yaml
180
112
# tftest-file id=demo_tag path=data/demo.yaml
181
113
182
- region : europe-west2
183
114
display_name : Demo Tag Template
184
115
fields :
185
116
source :
186
117
display_name : Source of data asset
118
+ is_required : true
187
119
type :
188
120
primitive_type : STRING
189
- is_required : true
190
121
pii_type :
191
122
display_name : PII type
192
123
type :
193
- enum_type :
124
+ enum_type_values :
194
125
- EMAIL
195
126
- SOCIAL SECURITY NUMBER
196
127
- NONE
@@ -200,17 +131,15 @@ fields:
200
131
201
132
| name | description | type | required | default |
202
133
|---|---|:---:|:---:|:---:|
203
- | [project_id](variables.tf#L62) | Id of the project where Tag Templates will be created. | <code>string</code> | ✓ | |
134
+ | [project_id](variables.tf#L26) | Id of the project where Tag Templates will be created. | <code>string</code> | ✓ | |
135
+ | [region](variables.tf#L31) | Default region for tag templates. | <code>string</code> | ✓ | |
204
136
| [factories_config](variables.tf#L17) | Paths to data files and folders that enable factory functionality. | <code title="object({ tag_templates = optional(string) })">object({…})</code> | | <code>{}</code> |
205
- | [iam](variables.tf#L26) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
206
- | [iam_bindings](variables.tf#L32) | Authoritative IAM bindings in {KEY => {role = ROLE, members = [], condition = {}}}. Keys are arbitrary. | <code title="map(object({ members = list(string) role = string condition = optional(object({ expression = string title = string description = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
207
- | [iam_bindings_additive](variables.tf#L47) | Individual additive IAM bindings. Keys are arbitrary. | <code title="map(object({ member = string role = string condition = optional(object({ expression = string title = string description = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
208
- | [tag_templates](variables.tf#L67) | Tag templates definitions in the form {TAG_TEMPLATE_ID => TEMPLATE_DEFINITION}. | <code title="map(object({ display_name = optional(string) force_delete = optional(bool, false) region = string fields = map(object({ display_name = optional(string) description = optional(string) type = object({ primitive_type = optional(string) enum_type = optional(list(object({ allowed_values = object({ display_name = string }) })), null) }) is_required = optional(bool, false) order = optional(number) })) }))">map(object({…}))</code> | | <code>{}</code> |
137
+ | [tag_templates](variables.tf#L36) | Tag templates definitions in the form {TAG_TEMPLATE_ID => TEMPLATE_DEFINITION}. | <code title="map(object({ display_name = optional(string) force_delete = optional(bool, false) region = optional(string) fields = map(object({ display_name = optional(string) description = optional(string) is_required = optional(bool, false) order = optional(number) type = object({ primitive_type = optional(string) enum_type_values = optional(list(string)) }) })) iam = optional(map(list(string)), {}) iam_bindings = optional(map(object({ members = list(string) role = string condition = optional(object({ expression = string title = string description = optional(string) })) })), {}) iam_bindings_additive = optional(map(object({ member = string role = string condition = optional(object({ expression = string title = string description = optional(string) })) })), {}) }))">map(object({…}))</code> | | <code>{}</code> |
209
138
210
139
## Outputs
211
140
212
141
| name | description | sensitive |
213
142
|---|---|:---:|
214
143
| [data_catalog_tag_template_ids](outputs.tf#L17) | Data catalog tag template ids. | |
215
- | [data_catalog_tag_templates](outputs.tf#L22 ) | Data catalog tag templates. | |
144
+ | [data_catalog_tag_templates](outputs.tf#L25 ) | Data catalog tag templates. | |
216
145
<!-- END TFDOC -->
0 commit comments