hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.36k stars 1.75k forks source link

Need ability to rename a google_data_catalog_policy_tag #17021

Open arnabbhagabati opened 10 months ago

arnabbhagabati commented 10 months ago

Community Note

Description

Currently the google_data_catalog_policy_tag module seems to be able to create and delete a policy tag only. It should be able to rename a policy tag as well, since this feature is available via GCP console.

While recreating a policy tag with the new name might seem like a solution/workaround, but it is not. Recreating a policy tag will remove the older policy tag, thus making all the bigquery table columns which was tagged with the older policy tag orphaned. In some scenarios, the number of such tables is huge (1000s) - finding all sch columns and tables and re adding the new policy tag to all of them is a mammoth task.

New or Affected Resource(s)

* google_data_catalog_policy_tag

Potential Terraform Configuration

Adding the name field as user provided argument will provide an opportunity to identify the policy tag. The display_name argument then can be used to set/modify the display name of the policy tag, thus renaming it.

resource "google_data_catalog_policy_tag" "basic_policy_tag" {
  taxonomy = google_data_catalog_taxonomy.my_taxonomy.id
  display_name = "Low security"
  name = "projects/{project}/locations/{region}/taxonomies/{taxonomy}/policyTags/{policytag}"
  description = "A policy tag normally associated with low security items"
}

References

b/321386125

melinath commented 10 months ago

The API documentation doesn't indicate this field can be updated, so I'm marking this as a feature request. (The Cloud Console can sometimes take actions not supported by the API.)