I am attaching a tag-template to a column of a BigQuery table. For this, I am using Terraform and I have just recreated the code in the terraform documentation.

resource "google_data_catalog_entry" "entry" {
  entry_group = google_data_catalog_entry_group.entry_group.id
  entry_id = "my_entry"

  user_specified_type = "my_custom_type"
  user_specified_system = "SomethingExternal"

  schema = <<EOF
{
  "columns": [...]
}
EOF
}

resource "google_data_catalog_entry_group" "entry_group" {
  entry_group_id = "my_entry_group"
}

resource "google_data_catalog_tag_template" "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
  }
  force_delete = "true"
}

resource "google_data_catalog_tag" "basic_tag" {
  parent   = google_data_catalog_entry.entry.id
  template = google_data_catalog_tag_template.tag_template.id

  fields {
    field_name   = "source"
    string_value = "my-string"
  }
  column = "address"
}

Docs: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/data_catalog_tag

Unfortunately, every time I run 'terraform apply' twice, I obtain the next API error:

Error: Error updating Tag "projects/xxxx/locations/europe-west2/entryGroups/xxxx/entries/xxxx/tags/xxx": googleapi: Error 400: Unsupported field mask path: "column", supported field masks are:
fields

It is like Terraform is not happy when I create this resource twice. To avoid this I have used:

  count    = local.created_tag ? 1 : 0

But I wonder what might be the cause and if there is a better way to solve the issue.

0

There are 0 best solutions below