A tag template defines a tag, which can have one or more typed fields. The template is used to create and attach the tag to GCP resources.
To get more information about TagTemplate, see:
resource "google_data_catalog_tag_template" "basic_tag_template" {
tag_template_id = "my_template"
region = "us-central1"
display_name = "Demo Tag Template"
fields {
field_id = "source"
display_name = "Source of data asset"
type {
primitive_type = "STRING"
}
is_required = true
}
fields {
field_id = "num_rows"
display_name = "Number of rows in the data asset"
type {
primitive_type = "DOUBLE"
}
}
fields {
field_id = "pii_type"
display_name = "PII type"
type {
enum_type {
allowed_values {
display_name = "EMAIL"
}
allowed_values {
display_name = "SOCIAL SECURITY NUMBER"
}
allowed_values {
display_name = "NONE"
}
}
}
}
force_delete = "false"
}
The following arguments are supported:
fields
-
(Required)
Set of tag template field IDs and the settings for the field. This set is an exhaustive list of the allowed fields. This set must contain at least one field and at most 500 fields. The change of field_id will be resulting in re-creating of field. The change of primitive_type will be resulting in re-creating of field, however if the field is a required, you cannot update it.
Structure is documented below.
tag_template_id
-
(Required)
The id of the tag template to create.
field_id
- (Required) The identifier for this object. Format specified above.
name
-
(Output)
The resource name of the tag template field in URL format. Example: projects/{project_id}/locations/{location}/tagTemplates/{tagTemplateId}/fields/{field}
display_name
-
(Optional)
The display name for this field.
description
-
(Optional)
A description for this field.
type
-
(Required)
The type of value this tag field can contain.
Structure is documented below.
is_required
-
(Optional)
Whether this is a required field. Defaults to false.
order
-
(Optional)
The order of this field with respect to other fields in this tag template.
A higher value indicates a more important field. The value can be negative.
Multiple fields can have the same order, and field orders within a tag do not have to be sequential.
primitive_type
-
(Optional)
Represents primitive types - string, bool etc.
Exactly one of primitive_type
or enum_type
must be set
Possible values are: DOUBLE
, STRING
, BOOL
, TIMESTAMP
.
enum_type
-
(Optional)
Represents an enum type.
Exactly one of primitive_type
or enum_type
must be set
Structure is documented below.
allowed_values
-
(Required)
The set of allowed values for this enum. The display names of the
values must be case-insensitively unique within this set. Currently,
enum values can only be added to the list of allowed values. Deletion
and renaming of enum values are not supported.
Can have up to 500 allowed values.
Structure is documented below.The allowed_values
block supports:
display_name
-
(Required)
The display name of the enum value.display_name
-
(Optional)
The display name for this template.
region
-
(Optional)
Template location region.
force_delete
-
(Optional)
This confirms the deletion of any possible tags using this template. Must be set to true in order to delete the tag template.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format {{name}}
name
-
The resource name of the tag template in URL format. Example: projects/{project_id}/locations/{location}/tagTemplates/{tagTemplateId}
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.TagTemplate can be imported using any of these accepted formats:
{{name}}
In Terraform v1.5.0 and later, use an import
block to import TagTemplate using one of the formats above. For example:
import {
id = "{{name}}"
to = google_data_catalog_tag_template.default
}
When using the terraform import
command, TagTemplate can be imported using one of the formats above. For example:
$ terraform import google_data_catalog_tag_template.default {{name}}
This resource supports User Project Overrides.