Google Data catalog Tag Template

This page shows how to write Terraform for Data catalog Tag Template and write them securely.

google_data_catalog_tag_template (Terraform)

The Tag Template in Data catalog can be configured in Terraform with the resource name google_data_catalog_tag_template. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub
resource "google_data_catalog_tag_template" "data_governance_tag_template" {
  tag_template_id = "data_governance_mock"
  project         = var.proj_id
  display_name    = "Data Governance Mock"
  region          = "us-east1"
  force_delete    = true
resource "google_data_catalog_tag_template" "data_eng_template" {
  provider               = google.access_token
  tag_template_id = "data_eng_template"
  region = var.tag_template_region
  display_name = "Data Engineering Template"
resource "google_data_catalog_tag_template" "this" {
  display_name    = var.display_name
  force_delete    = var.force_delete
  project         = var.project
  region          = var.region
  tag_template_id = var.tag_template_id
resource "google_data_catalog_tag_template" "tag_template" {
  for_each        = local.tag_template
  project         = var.project_id
  region          = var.region
  tag_template_id = lower(each.key)
  display_name    = each.value["display_name"]

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


The display name for this template.

This confirms the deletion of any possible tags using this template. Must be set to true in order to delete the tag template.

  • id optional computed - string
  • name optional computed - string

The resource name of the tag template in URL format. Example: projects/[project_id]/locations/[location]/tagTemplates/[tagTemplateId]

Template location region.

The id of the tag template to create.

  • fields set block

    A description for this field.

    The display name for this field.

    Whether this is a required field. Defaults to false.

    • name optional computed - string

    The resource name of the tag template field in URL format. Example: projects/[project_id]/locations/[location]/tagTemplates/[tagTemplateId]/fields/[field]

    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.

    • type list block

      Represents primitive types - string, bool etc. Exactly one of 'primitive_type' or 'enum_type' must be set Possible values: ["DOUBLE", "STRING", "BOOL", "TIMESTAMP"]

  • timeouts single block

Explanation in Terraform Registry

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:

Frequently asked questions

What is Google Data catalog Tag Template?

Google Data catalog Tag Template is a resource for Data catalog of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Data catalog Tag Template?

For Terraform, the JCFlores93/data-catalog-mock-error, mesmacosta/google-datacatalog-governance-best-pratices and niveklabs/google source code examples are useful. See the Terraform Example section for further details.


Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.