2

我将标签模板附加到 BigQuery 表的列。为此,我正在使用 Terraform,并且我刚刚在 terraform 文档中重新创建了代码。

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"
}

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

不幸的是,每次我运行 'terraform apply' 两次,我都会得到下一个 API 错误:

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

当我两次创建此资源时,Terraform 就像不高兴一样。为了避免这种情况,我使用了:

  count    = local.created_tag ? 1 : 0

但我想知道可能是什么原因,是否有更好的方法来解决这个问题。

4

0 回答 0