Skip to content

googleDataCatalogTagTemplate

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:

Example Usage - Data Catalog Tag Template Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.dataCatalogTagTemplate.DataCatalogTagTemplate(
  this,
  "basic_tag_template",
  {
    display_name: "Demo Tag Template",
    fields: [
      {
        display_name: "Source of data asset",
        field_id: "source",
        is_required: true,
        type: [
          {
            primitive_type: "STRING",
          },
        ],
      },
      {
        display_name: "Number of rows in the data asset",
        field_id: "num_rows",
        type: [
          {
            primitive_type: "DOUBLE",
          },
        ],
      },
      {
        display_name: "PII type",
        field_id: "pii_type",
        type: [
          {
            enum_type: [
              {
                allowed_values: [
                  {
                    display_name: "EMAIL",
                  },
                  {
                    display_name: "SOCIAL SECURITY NUMBER",
                  },
                  {
                    display_name: "NONE",
                  },
                ],
              },
            ],
          },
        ],
      },
    ],
    force_delete: "false",
    region: "us-central1",
    tag_template_id: "my_template",
  }
);

Argument Reference

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.

  • tagTemplateId - (Required) The id of the tag template to create.

The fields block supports:

  • fieldId - (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}

  • displayName - (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.

  • isRequired - (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.

The type block supports:

  • primitiveType - (Optional) Represents primitive types - string, bool etc. Exactly one of primitiveType or enumType must be set Possible values are double, string, bool, and timestamp.

  • enumType - (Optional) Represents an enum type. Exactly one of primitiveType or enumType must be set Structure is documented below.

The enumType block supports:

  • allowedValues - (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 allowedValues block supports:

  • displayName - (Required) The display name of the enum value.

  • displayName - (Optional) The display name for this template.

  • region - (Optional) Template location region.

  • forceDelete - (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.

Attributes Reference

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}

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

TagTemplate can be imported using any of these accepted formats:

$ terraform import google_data_catalog_tag_template.default {{name}}

User Project Overrides

This resource supports User Project Overrides.