Module Data Catalog Tag - Add support for types (#2100)
* Add support for types * implement feedback * Remove display name field.
This commit is contained in:
parent
220ab76e40
commit
1c26c8f8a3
|
@ -5,6 +5,8 @@ This module allows managing [Data Catalog Tag](https://cloud.google.com/data-cat
|
|||
## TODO
|
||||
|
||||
- Add support for entries different than Bigquery resources.
|
||||
- Add support to BOOL when [issue](https://github.com/hashicorp/terraform-provider-google/issues/16856) is fixed.
|
||||
- Add support to RICHTEXT when [issue](https://github.com/hashicorp/terraform-provider-google/issues/13597) is fixed.
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -20,7 +22,18 @@ module "data-catalog-tag" {
|
|||
location = "europe-west1"
|
||||
template = "projects/project-datagov/locations/europe-west1/tagTemplates/demo"
|
||||
fields = {
|
||||
source = "DB-1"
|
||||
source = {
|
||||
string_value = "DB-1"
|
||||
}
|
||||
datetime = {
|
||||
timestamp_value = "2024-02-03T06:50:50.91Z"
|
||||
}
|
||||
num = {
|
||||
double_value = 4.3
|
||||
}
|
||||
pii = {
|
||||
enum_value = "NONE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +53,9 @@ module "data-catalog-tag" {
|
|||
location = "europe-west1"
|
||||
template = "projects/project-datagov/locations/europe-west1/tagTemplates/demo"
|
||||
fields = {
|
||||
source = "DB-1 Table-A"
|
||||
source = {
|
||||
string_value = "DB-1 Table-A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +76,9 @@ module "data-catalog-tag" {
|
|||
location = "europe-west1"
|
||||
template = "projects/project-datagov/locations/europe-west1/tagTemplates/demo"
|
||||
fields = {
|
||||
source = "DB-1 Table-A Column-B"
|
||||
source = {
|
||||
string_value = "DB-1 Table-A Column-B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +107,9 @@ module "data-catalog-tag" {
|
|||
location = "europe-west1"
|
||||
template = "projects/project-datagov/locations/europe-west1/tagTemplates/demo"
|
||||
fields = {
|
||||
source = "DB-1 Table-A Column-B"
|
||||
source = {
|
||||
string_value = "DB-1 Table-A Column-B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +128,12 @@ parent: projects/project-data-product/datasets/exposure
|
|||
location: europe-west1
|
||||
template: projects/project-datagov/locations/europe-west1/tagTemplates/test
|
||||
fields:
|
||||
owner_email: example@example.com
|
||||
owner_email:
|
||||
string_value: example@example.com
|
||||
num:
|
||||
double_value: 5
|
||||
pii:
|
||||
enum_value: NONE
|
||||
```
|
||||
<!-- BEGIN TFDOC -->
|
||||
## Variables
|
||||
|
@ -117,7 +141,7 @@ fields:
|
|||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [factories_config](variables.tf#L17) | Paths to data files and folders that enable factory functionality. | <code title="object({ tags = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [tags](variables.tf#L26) | Tags definitions in the form {TAG => TAG_DEFINITION}. | <code title="map(object({ project_id = string parent = string column = optional(string) location = string template = string fields = map(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [tags](variables.tf#L26) | Tags definitions in the form {TAG => TAG_DEFINITION}. | <code title="map(object({ project_id = string parent = string column = optional(string) location = string template = string fields = map(object({ double_value = optional(number) string_value = optional(string) timestamp_value = optional(string) enum_value = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
|
|
@ -31,8 +31,11 @@ resource "google_data_catalog_tag" "engine" {
|
|||
dynamic "fields" {
|
||||
for_each = each.value.fields
|
||||
content {
|
||||
field_name = fields.key
|
||||
string_value = fields.value
|
||||
field_name = fields.key
|
||||
double_value = try(fields.value.double_value, null)
|
||||
enum_value = try(fields.value.enum_value, null)
|
||||
string_value = try(fields.value.string_value, null)
|
||||
timestamp_value = try(fields.value.timestamp_value, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,12 @@ variable "tags" {
|
|||
column = optional(string)
|
||||
location = string
|
||||
template = string
|
||||
fields = map(string)
|
||||
fields = map(object({
|
||||
double_value = optional(number)
|
||||
string_value = optional(string)
|
||||
timestamp_value = optional(string)
|
||||
enum_value = optional(string)
|
||||
}))
|
||||
}))
|
||||
default = {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue