Skip to content

googleDataCatalogTag

Tags are used to attach custom metadata to Data Catalog resources. Tags conform to the specifications within their tag template.

See Data Catalog IAM for information on the permissions needed to create or view tags.

To get more information about Tag, see:

Example Usage - Data Catalog Entry Tag 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.*/
const googleDataCatalogEntryGroupEntryGroup =
  new google.dataCatalogEntryGroup.DataCatalogEntryGroup(this, "entry_group", {
    entry_group_id: "my_entry_group",
  });
const googleDataCatalogTagTemplateTagTemplate =
  new google.dataCatalogTagTemplate.DataCatalogTagTemplate(
    this,
    "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",
    }
  );
const googleDataCatalogEntryEntry =
  new google.dataCatalogEntry.DataCatalogEntry(this, "entry", {
    entry_group: googleDataCatalogEntryGroupEntryGroup.id,
    entry_id: "my_entry",
    user_specified_system: "SomethingExternal",
    user_specified_type: "my_custom_type",
  });
new google.dataCatalogTag.DataCatalogTag(this, "basic_tag", {
  fields: [
    {
      field_name: "source",
      string_value: "my-string",
    },
  ],
  parent: googleDataCatalogEntryEntry.id,
  template: googleDataCatalogTagTemplateTagTemplate.id,
});

Example Usage - Data Catalog Entry Group Tag

/*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.*/
const googleDataCatalogEntryGroupEntryGroup =
  new google.dataCatalogEntryGroup.DataCatalogEntryGroup(this, "entry_group", {
    entry_group_id: "my_entry_group",
  });
const googleDataCatalogTagTemplateTagTemplate =
  new google.dataCatalogTagTemplate.DataCatalogTagTemplate(
    this,
    "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",
    }
  );
new google.dataCatalogEntry.DataCatalogEntry(this, "first_entry", {
  entry_group: googleDataCatalogEntryGroupEntryGroup.id,
  entry_id: "first_entry",
  user_specified_system: "SomethingExternal",
  user_specified_type: "my_custom_type",
});
new google.dataCatalogEntry.DataCatalogEntry(this, "second_entry", {
  entry_group: googleDataCatalogEntryGroupEntryGroup.id,
  entry_id: "second_entry",
  user_specified_system: "SomethingElseExternal",
  user_specified_type: "another_custom_type",
});
new google.dataCatalogTag.DataCatalogTag(this, "entry_group_tag", {
  fields: [
    {
      field_name: "source",
      string_value: "my-string",
    },
  ],
  parent: googleDataCatalogEntryGroupEntryGroup.id,
  template: googleDataCatalogTagTemplateTagTemplate.id,
});

Example Usage - Data Catalog Entry Tag Full

/*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.*/
const googleDataCatalogEntryGroupEntryGroup =
  new google.dataCatalogEntryGroup.DataCatalogEntryGroup(this, "entry_group", {
    entry_group_id: "my_entry_group",
  });
const googleDataCatalogTagTemplateTagTemplate =
  new google.dataCatalogTagTemplate.DataCatalogTagTemplate(
    this,
    "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",
    }
  );
const googleDataCatalogEntryEntry =
  new google.dataCatalogEntry.DataCatalogEntry(this, "entry", {
    entry_group: googleDataCatalogEntryGroupEntryGroup.id,
    entry_id: "my_entry",
    schema:
      '{\n  "columns": [\n    {\n      "column": "first_name",\n      "description": "First name",\n      "mode": "REQUIRED",\n      "type": "STRING"\n    },\n    {\n      "column": "last_name",\n      "description": "Last name",\n      "mode": "REQUIRED",\n      "type": "STRING"\n    },\n    {\n      "column": "address",\n      "description": "Address",\n      "mode": "REPEATED",\n      "subcolumns": [\n        {\n          "column": "city",\n          "description": "City",\n          "mode": "NULLABLE",\n          "type": "STRING"\n        },\n        {\n          "column": "state",\n          "description": "State",\n          "mode": "NULLABLE",\n          "type": "STRING"\n        }\n      ],\n      "type": "RECORD"\n    }\n  ]\n}\n',
    user_specified_system: "SomethingExternal",
    user_specified_type: "my_custom_type",
  });
new google.dataCatalogTag.DataCatalogTag(this, "basic_tag", {
  column: "address",
  fields: [
    {
      field_name: "source",
      string_value: "my-string",
    },
    {
      double_value: 5,
      field_name: "num_rows",
    },
    {
      enum_value: "EMAIL",
      field_name: "pii_type",
    },
  ],
  parent: googleDataCatalogEntryEntry.id,
  template: googleDataCatalogTagTemplateTagTemplate.id,
});
new google.dataCatalogTag.DataCatalogTag(this, "second-tag", {
  column: "first_name",
  fields: [
    {
      field_name: "source",
      string_value: "my-string",
    },
    {
      enum_value: "NONE",
      field_name: "pii_type",
    },
  ],
  parent: googleDataCatalogEntryEntry.id,
  template: googleDataCatalogTagTemplateTagTemplate.id,
});

Argument Reference

The following arguments are supported:

  • template - (Required) The resource name of the tag template that this tag uses. Example: projects/{project_id}/locations/{location}/tagTemplates/{tagTemplateId} This field cannot be modified after creation.

  • fields - (Required) This maps the ID of a tag field to the value of and additional information about that field. Valid field IDs are defined by the tag's template. A tag must have at least 1 field and at most 500 fields. Structure is documented below.

The fields block supports:

  • fieldName - (Required) The identifier for this object. Format specified above.

  • displayName - (Output) The display name of this field

  • order - (Output) The order of this field with respect to other fields in this tag. For example, a higher value can indicate 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.

  • doubleValue - (Optional) Holds the value for a tag field with double type.

  • stringValue - (Optional) Holds the value for a tag field with string type.

  • boolValue - (Optional) Holds the value for a tag field with boolean type.

  • timestampValue - (Optional) Holds the value for a tag field with timestamp type.

  • enumValue - (Optional) Holds the value for a tag field with enum type. This value must be one of the allowed values in the definition of this enum.


  • column - (Optional) Resources like Entry can have schemas associated with them. This scope allows users to attach tags to an individual column based on that schema. For attaching a tag to a nested column, use . to separate the column names. Example: outerColumnInnerColumn

  • parent - (Optional) The name of the parent this tag is attached to. This can be the name of an entry or an entry group. If an entry group, the tag will be attached to all entries in that group.

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 in URL format. Example: projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/entries/{entryId}/tags/{tag_id} or projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/tags/{tag_id} where tag_id is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name.

  • templateDisplayname - The display name of the tag template.

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

Tag can be imported using any of these accepted formats:

$ terraform import google_data_catalog_tag.default {{name}}