From c8a53e5f5bcbf83d76464f38f5bd03ed269d6345 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Wed, 20 Sep 2023 20:12:36 -0700 Subject: [PATCH] Make labels field have all labels in data sources --- .../terraform/acctest/test_utils.go.erb | 6 ---- ...ata_source_artifact_registry_repository.go | 4 +++ ...ource_artifact_registry_repository_test.go | 4 +-- ...source_google_beyondcorp_app_connection.go | 4 +++ ...e_google_beyondcorp_app_connection_test.go | 3 ++ ..._source_google_beyondcorp_app_connector.go | 4 +++ ...ce_google_beyondcorp_app_connector_test.go | 3 ++ ...ta_source_google_beyondcorp_app_gateway.go | 4 +++ ...urce_google_beyondcorp_app_gateway_test.go | 3 ++ ...a_source_google_cloudfunctions_function.go | 4 +++ ...rce_google_cloudfunctions_function_test.go | 3 ++ ..._source_google_cloudfunctions2_function.go | 4 +++ ...ce_google_cloudfunctions2_function_test.go | 4 +-- ...data_source_google_composer_environment.go | 4 +++ ...source_google_composer_environment_test.go | 5 +++ .../data_source_google_compute_disk.go | 4 +++ .../data_source_google_compute_disk_test.go | 5 ++- ...a_source_google_compute_forwarding_rule.go | 4 +++ ...rce_google_compute_forwarding_rule_test.go | 3 ++ ...data_source_google_compute_instance.go.erb | 4 +++ ...ce_google_compute_instance_template.go.erb | 12 +++++-- ...e_google_compute_instance_template_test.go | 4 +++ ...data_source_google_compute_snapshot.go.erb | 5 ++- ...ata_source_google_compute_snapshot_test.go | 6 ++-- ...e_google_global_compute_forwarding_rule.go | 4 +++ ...gle_global_compute_forwarding_rule_test.go | 3 ++ ...a_source_dataproc_metastore_service.go.erb | 4 +++ ...rce_dataproc_metastore_service_test.go.erb | 4 +++ ...rce_google_firebase_hosting_channel.go.erb | 4 +++ ...oogle_firebase_hosting_channel_test.go.erb | 4 +++ .../kms/data_source_google_kms_crypto_key.go | 4 +++ .../data_source_certificate_authority.go | 4 +++ .../data_source_certificate_authority_test.go | 4 +++ .../pubsub/data_source_pubsub_subscription.go | 4 +++ .../data_source_pubsub_subscription_test.go | 3 ++ .../pubsub/data_source_pubsub_topic.go | 4 +++ .../pubsub/data_source_pubsub_topic_test.go | 3 ++ .../redis/data_source_redis_instance.go | 4 +++ .../redis/data_source_redis_instance_test.go | 4 +++ .../data_source_google_project.go | 4 +++ .../data_source_google_project_test.go | 3 ++ .../data_source_secret_manager_secret.go | 8 +++++ .../data_source_secret_manager_secret_test.go | 6 +++- .../spanner/data_source_spanner_instance.go | 4 +++ .../vertexai/data_source_vertex_ai_index.go | 4 +++ .../data_source_vertex_ai_index_test.go | 2 -- .../terraform/tpgresource/labels.go | 31 +++++++++++++++++++ .../d/cloudfunctions_function.html.markdown | 2 +- .../website/docs/d/compute_disk.html.markdown | 2 +- .../docs/d/compute_image.html.markdown | 2 +- .../docs/d/compute_instance.html.markdown | 2 +- .../d/compute_instance_template.html.markdown | 3 +- .../r/cloudfunctions_function.html.markdown | 3 ++ .../docs/r/composer_environment.html.markdown | 3 ++ .../docs/r/compute_instance.html.markdown | 2 ++ .../r/compute_instance_template.html.markdown | 6 ++++ .../website/docs/r/dataproc_job.html.markdown | 2 ++ .../docs/r/google_project.html.markdown | 2 ++ 58 files changed, 227 insertions(+), 27 deletions(-) diff --git a/mmv1/third_party/terraform/acctest/test_utils.go.erb b/mmv1/third_party/terraform/acctest/test_utils.go.erb index 3fc319222497..bf081eac3c9a 100644 --- a/mmv1/third_party/terraform/acctest/test_utils.go.erb +++ b/mmv1/third_party/terraform/acctest/test_utils.go.erb @@ -50,12 +50,6 @@ func CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourc if _, ok := ignoreFields[k]; ok { continue } - if _, ok := ignoreFields["labels.%"]; ok && strings.HasPrefix(k, "labels.") { - continue - } - if _, ok := ignoreFields["terraform_labels.%"]; ok && strings.HasPrefix(k, "terraform_labels.") { - continue - } if k == "%" { continue } diff --git a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository.go b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository.go index fb0271a17040..272ec3411b70 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository.go +++ b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository.go @@ -46,6 +46,10 @@ func dataSourceArtifactRegistryRepositoryRead(d *schema.ResourceData, meta inter return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository_test.go b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository_test.go index 735bec2d3beb..22c2f610e1e8 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository_test.go +++ b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_repository_test.go @@ -23,8 +23,8 @@ func TestAccDataSourceGoogleArtifactRegistryRepositoryConfig(t *testing.T) { { Config: testAccDataSourceGoogleArtifactRegistryRepositoryConfig(context), Check: resource.ComposeTestCheckFunc( - acctest.CheckDataSourceStateMatchesResourceStateWithIgnores(funcDataName, - "google_artifact_registry_repository.my-repo", map[string]struct{}{"labels.%": {}, "terraform_labels.%": {}}), + acctest.CheckDataSourceStateMatchesResourceState(funcDataName, + "google_artifact_registry_repository.my-repo"), ), }, }, diff --git a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection.go b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection.go index 13d16ca2c5de..38240dbb8e5f 100644 --- a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection.go +++ b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection.go @@ -46,6 +46,10 @@ func dataSourceGoogleBeyondcorpAppConnectionRead(d *schema.ResourceData, meta in return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection_test.go b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection_test.go index 66a488a29163..44288c2a5eca 100644 --- a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection_test.go +++ b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connection_test.go @@ -76,6 +76,9 @@ resource "google_beyondcorp_app_connection" "foo" { port = 8080 } connectors = [google_beyondcorp_app_connector.app_connector.id] + labels = { + my-label = "my-label-value" + } } data "google_beyondcorp_app_connection" "foo" { diff --git a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector.go b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector.go index b06bc5f4fbbe..1f4132bababc 100644 --- a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector.go +++ b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector.go @@ -46,6 +46,10 @@ func dataSourceGoogleBeyondcorpAppConnectorRead(d *schema.ResourceData, meta int return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector_test.go b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector_test.go index 5bf5acf3b67a..4a8274f905bc 100644 --- a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector_test.go +++ b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_connector_test.go @@ -179,6 +179,9 @@ resource "google_beyondcorp_app_connector" "foo" { email = google_service_account.service_account.email } } + labels = { + my-label = "my-label-value" + } } data "google_beyondcorp_app_connector" "foo" { diff --git a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway.go b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway.go index 104f2798482e..6f31635a2954 100644 --- a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway.go +++ b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway.go @@ -46,6 +46,10 @@ func dataSourceGoogleBeyondcorpAppGatewayRead(d *schema.ResourceData, meta inter return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway_test.go b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway_test.go index c7c8f943d446..ca345530c263 100644 --- a/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway_test.go +++ b/mmv1/third_party/terraform/services/beyondcorp/data_source_google_beyondcorp_app_gateway_test.go @@ -101,6 +101,9 @@ resource "google_beyondcorp_app_gateway" "foo" { name = "tf-test-appgateway-%{random_suffix}" type = "TCP_PROXY" host_type = "GCP_REGIONAL_MIG" + labels = { + my-label = "my-label-value" + } } data "google_beyondcorp_app_gateway" "foo" { diff --git a/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function.go b/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function.go index 5255c37268df..7d019ed5e2f0 100644 --- a/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function.go +++ b/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function.go @@ -50,6 +50,10 @@ func dataSourceGoogleCloudFunctionsFunctionRead(d *schema.ResourceData, meta int return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", cloudFuncId.CloudFunctionId()) } diff --git a/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function_test.go b/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function_test.go index 68dd233c3584..ee1d0bd66f10 100644 --- a/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function_test.go +++ b/mmv1/third_party/terraform/services/cloudfunctions/data_source_google_cloudfunctions_function_test.go @@ -61,6 +61,9 @@ resource "google_cloudfunctions_function" "function_http" { trigger_http = true timeout = 61 entry_point = "helloGET" + labels = { + my-label = "my-label-value" + } } data "google_cloudfunctions_function" "function_http" { diff --git a/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function.go b/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function.go index 6769c2701231..b04f0f692bb9 100644 --- a/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function.go +++ b/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function.go @@ -40,6 +40,10 @@ func dataSourceGoogleCloudFunctions2FunctionRead(d *schema.ResourceData, meta in return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function_test.go b/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function_test.go index 7f4d5db5baf7..b974538967eb 100644 --- a/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function_test.go +++ b/mmv1/third_party/terraform/services/cloudfunctions2/data_source_google_cloudfunctions2_function_test.go @@ -24,11 +24,9 @@ func TestAccDataSourceGoogleCloudFunctions2Function_basic(t *testing.T) { { Config: testAccDataSourceGoogleCloudFunctions2FunctionConfig(functionName, bucketName, zipFilePath), - // As the value of "labels" and "terraform_labels" in the state is dependent on the configuration, - // and these fields are not set in the configuration of the data source, so these fields are empty in the state of the data source. Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceStateWithIgnores(funcDataNameHttp, - "google_cloudfunctions2_function.function_http_v2", map[string]struct{}{"build_config.0.source.0.storage_source.0.bucket": {}, "build_config.0.source.0.storage_source.0.object": {}, "labels.%": {}, "terraform_labels.%": {}}), + "google_cloudfunctions2_function.function_http_v2", map[string]struct{}{"build_config.0.source.0.storage_source.0.bucket": {}, "build_config.0.source.0.storage_source.0.object": {}}), ), }, }, diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment.go b/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment.go index 5b37ab9ad17a..cf52d32638d6 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment.go +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment.go @@ -42,6 +42,10 @@ func dataSourceGoogleComposerEnvironmentRead(d *schema.ResourceData, meta interf return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment_test.go b/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment_test.go index b01db3b3e114..a81eff7b2284 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment_test.go +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_environment_test.go @@ -25,6 +25,8 @@ func TestAccDataSourceComposerEnvironment_basic(t *testing.T) { { Config: testAccDataSourceComposerEnvironment_basic(context), Check: resource.ComposeTestCheckFunc( + acctest.CheckDataSourceStateMatchesResourceState("data.google_composer_environment.test", + "google_composer_environment.test"), testAccCheckGoogleComposerEnvironmentMeta("data.google_composer_environment.test"), ), }, @@ -91,6 +93,9 @@ resource "google_composer_environment" "test" { image_version = "composer-1-airflow-2" } } + labels = { + my-label = "my-label-value" + } } // use a separate network to avoid conflicts with other tests running in parallel diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk.go index 7a68c1fa9f7c..d96674df17d7 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk.go @@ -34,6 +34,10 @@ func dataSourceGoogleComputeDiskRead(d *schema.ResourceData, meta interface{}) e return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk_test.go index 3ab5cb82b9eb..b978a3834c4c 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_disk_test.go @@ -32,7 +32,10 @@ func TestAccDataSourceGoogleComputeDisk_basic(t *testing.T) { func testAccDataSourceGoogleComputeDisk_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_compute_disk" "foo" { - name = "tf-test-compute-disk-%{random_suffix}" + name = "tf-test-compute-disk-%{random_suffix}" + labels = { + my-label = "my-label-value" + } } data "google_compute_disk" "foo" { diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule.go index 555748f1064e..3e7abe2278d1 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule.go @@ -47,6 +47,10 @@ func dataSourceGoogleComputeForwardingRuleRead(d *schema.ResourceData, meta inte return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule_test.go index 1238648064a5..b30bb8ce3056 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_forwarding_rule_test.go @@ -40,6 +40,9 @@ resource "google_compute_forwarding_rule" "foobar-fr" { name = "%s" port_range = "80-81" target = google_compute_target_pool.foobar-tp.self_link + labels = { + my-label = "my-label-value" + } } data "google_compute_forwarding_rule" "my_forwarding_rule" { diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.erb b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.erb index 0c885da98bd8..7b0734cf6455 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.erb +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.erb @@ -98,6 +98,10 @@ func dataSourceGoogleComputeInstanceRead(d *schema.ResourceData, meta interface{ return err } + if err := d.Set("terraform_labels", instance.Labels); err != nil { + return err + } + if instance.LabelFingerprint != "" { if err := d.Set("label_fingerprint", instance.LabelFingerprint); err != nil { return fmt.Errorf("Error setting label_fingerprint: %s", err) diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template.go.erb b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template.go.erb index ee82da732187..167b01116066 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template.go.erb +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template.go.erb @@ -92,7 +92,11 @@ func datasourceComputeInstanceTemplateRead(d *schema.ResourceData, meta interfac func retrieveInstance(d *schema.ResourceData, meta interface{}, project, name string) error { d.SetId("projects/" + project + "/global/instanceTemplates/" + name) - return resourceComputeInstanceTemplateRead(d, meta) + if err := resourceComputeInstanceTemplateRead(d, meta); err != nil { + return err + } + + return tpgresource.SetDataSourceLabels(d) } func retrieveInstanceFromUniqueId(d *schema.ResourceData, meta interface{}, project, self_link_unique string) error { @@ -100,7 +104,11 @@ func retrieveInstanceFromUniqueId(d *schema.ResourceData, meta interface{}, proj d.SetId(normalId) d.Set("self_link_unique", self_link_unique) - return resourceComputeInstanceTemplateRead(d, meta) + if err := resourceComputeInstanceTemplateRead(d, meta); err != nil { + return err + } + + return tpgresource.SetDataSourceLabels(d) } // ByCreationTimestamp implements sort.Interface for []*InstanceTemplate based on diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template_test.go index 9ed0dffc7f67..363c03f93def 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance_template_test.go @@ -115,6 +115,10 @@ resource "google_compute_instance_template" "default" { network_interface { network = "default" } + + labels = { + my-label = "my-label-value" + } } data "google_compute_instance_template" "default" { diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot.go.erb b/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot.go.erb index ea1d893715c2..a226612788c3 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot.go.erb +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot.go.erb @@ -107,7 +107,10 @@ func dataSourceGoogleComputeSnapshotRead(d *schema.ResourceData, meta interface{ func retrieveSnapshot(d *schema.ResourceData, meta interface{}, project, name string) error { d.SetId("projects/" + project + "/global/snapshots/" + name) d.Set("name", name) - return resourceComputeSnapshotRead(d, meta) + if err := resourceComputeSnapshotRead(d, meta); err != nil { + return err + } + return tpgresource.SetDataSourceLabels(d) } // ByCreationTimestamp implements sort.Interface for []*Snapshot based on diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot_test.go index 2706ad32c8f2..97c0c1111646 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_snapshot_test.go @@ -21,7 +21,7 @@ func TestAccSnapshotDatasource_name(t *testing.T) { acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_snapshot.default", "google_compute_snapshot.default", - map[string]struct{}{"zone": {}, "labels.%": {}, "terraform_labels.%": {}}, + map[string]struct{}{"zone": {}}, ), ), }, @@ -42,7 +42,7 @@ func TestAccSnapshotDatasource_filter(t *testing.T) { acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_snapshot.default", "google_compute_snapshot.c", - map[string]struct{}{"zone": {}, "labels.%": {}, "terraform_labels.%": {}}, + map[string]struct{}{"zone": {}}, ), ), }, @@ -63,7 +63,7 @@ func TestAccSnapshotDatasource_filterMostRecent(t *testing.T) { acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_compute_snapshot.default", "google_compute_snapshot.c", - map[string]struct{}{"zone": {}, "labels.%": {}, "terraform_labels.%": {}}, + map[string]struct{}{"zone": {}}, ), ), }, diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule.go b/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule.go index ed1bad56b537..24b840a9383e 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule.go @@ -41,6 +41,10 @@ func dataSourceGoogleComputeGlobalForwardingRuleRead(d *schema.ResourceData, met return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule_test.go index 70e2f3e6099d..bfb94ba7d822 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_global_compute_forwarding_rule_test.go @@ -32,6 +32,9 @@ resource "google_compute_global_forwarding_rule" "foobar-fr" { name = "%s" target = google_compute_target_http_proxy.default.id port_range = "80" + labels = { + my-label = "my-label-value" + } } resource "google_compute_target_http_proxy" "default" { diff --git a/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service.go.erb b/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service.go.erb index 76b166edfa33..38225a1d54ad 100644 --- a/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service.go.erb +++ b/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service.go.erb @@ -33,6 +33,10 @@ func dataSourceDataprocMetastoreServiceRead(d *schema.ResourceData, meta interfa return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service_test.go.erb b/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service_test.go.erb index 23832fffb79c..bb8ef1bcabdc 100644 --- a/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service_test.go.erb +++ b/mmv1/third_party/terraform/services/dataprocmetastore/data_source_dataproc_metastore_service_test.go.erb @@ -38,6 +38,10 @@ resource "google_dataproc_metastore_service" "my_metastore" { hive_metastore_config { version = "2.3.6" } + + labels = { + env = "test" + } } data "google_dataproc_metastore_service" "my_metastore" { diff --git a/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel.go.erb b/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel.go.erb index 993392fd2b1c..1a888cbd4f6c 100644 --- a/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel.go.erb +++ b/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel.go.erb @@ -36,6 +36,10 @@ func dataSourceGoogleFirebaseHostingChannelRead(d *schema.ResourceData, meta int return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel_test.go.erb b/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel_test.go.erb index ecb0f42ddd07..dc9adf02ea9e 100644 --- a/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel_test.go.erb +++ b/mmv1/third_party/terraform/services/firebasehosting/data_source_google_firebase_hosting_channel_test.go.erb @@ -44,6 +44,10 @@ resource "google_firebase_hosting_site" "default" { resource "google_firebase_hosting_channel" "channel" { site_id = google_firebase_hosting_site.default.site_id channel_id = "tf-test-channel%{random_suffix}" + + labels = { + foo = "bar" + } } data "google_firebase_hosting_channel" "channel" { diff --git a/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key.go b/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key.go index 0d39492d0f27..670d67f40e66 100644 --- a/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key.go +++ b/mmv1/third_party/terraform/services/kms/data_source_google_kms_crypto_key.go @@ -41,6 +41,10 @@ func dataSourceGoogleKmsCryptoKeyRead(d *schema.ResourceData, meta interface{}) return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority.go b/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority.go index b2beeb943b01..062930dca191 100644 --- a/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority.go +++ b/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority.go @@ -45,6 +45,10 @@ func dataSourcePrivatecaCertificateAuthorityRead(d *schema.ResourceData, meta in return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + // pem_csr is only applicable for SUBORDINATE CertificateAuthorities when their state is AWAITING_USER_ACTIVATION if d.Get("type") == "SUBORDINATE" && d.Get("state") == "AWAITING_USER_ACTIVATION" { url, err := tpgresource.ReplaceVars(d, config, "{{PrivatecaBasePath}}projects/{{project}}/locations/{{location}}/caPools/{{pool}}/certificateAuthorities/{{certificate_authority_id}}:fetch") diff --git a/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority_test.go b/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority_test.go index 2a7cdfb4c2d1..39aa17efcc87 100644 --- a/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority_test.go +++ b/mmv1/third_party/terraform/services/privateca/data_source_certificate_authority_test.go @@ -24,6 +24,7 @@ func TestAccDataSourcePrivatecaCertificateAuthority_privatecaCertificateAuthorit { Config: testAccDataSourcePrivatecaCertificateAuthority_privatecaCertificateAuthorityBasicExample(context), Check: resource.ComposeTestCheckFunc( + acctest.CheckDataSourceStateMatchesResourceState("data.google_privateca_certificate_authority.default", "google_privateca_certificate_authority.default"), resource.TestCheckResourceAttrSet("data.google_privateca_certificate_authority.default", "pem_csr"), ), }, @@ -81,6 +82,9 @@ resource "google_privateca_certificate_authority" "default" { key_spec { algorithm = "RSA_PKCS1_4096_SHA256" } + labels = { + my-label = "my-label-value" + } } data "google_privateca_certificate_authority" "default" { diff --git a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription.go b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription.go index 2e0b49ecb368..dde9618c8327 100644 --- a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription.go +++ b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription.go @@ -33,6 +33,10 @@ func dataSourceGooglePubsubSubscriptionRead(d *schema.ResourceData, meta interfa return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription_test.go b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription_test.go index a5c976e9241e..ffe48a0bae3a 100644 --- a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription_test.go +++ b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_subscription_test.go @@ -60,6 +60,9 @@ resource "google_pubsub_topic" "foo" { resource "google_pubsub_subscription" "foo" { name = "tf-test-pubsub-subscription-%{random_suffix}" topic = google_pubsub_topic.foo.name + labels = { + my-label = "my-label-value" + } } data "google_pubsub_subscription" "foo" { diff --git a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic.go b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic.go index 158d1c600535..a813bc152dca 100644 --- a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic.go +++ b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic.go @@ -33,6 +33,10 @@ func dataSourceGooglePubsubTopicRead(d *schema.ResourceData, meta interface{}) e return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic_test.go b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic_test.go index b5f6efa8504c..e3b4614d1ca6 100644 --- a/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic_test.go +++ b/mmv1/third_party/terraform/services/pubsub/data_source_pubsub_topic_test.go @@ -55,6 +55,9 @@ func testAccDataSourceGooglePubsubTopic_basic(context map[string]interface{}) st return acctest.Nprintf(` resource "google_pubsub_topic" "foo" { name = "tf-test-pubsub-%{random_suffix}" + labels = { + my-label = "my-label-value" + } } data "google_pubsub_topic" "foo" { diff --git a/mmv1/third_party/terraform/services/redis/data_source_redis_instance.go b/mmv1/third_party/terraform/services/redis/data_source_redis_instance.go index 2dd7ad098b71..1d16a177a860 100644 --- a/mmv1/third_party/terraform/services/redis/data_source_redis_instance.go +++ b/mmv1/third_party/terraform/services/redis/data_source_redis_instance.go @@ -36,6 +36,10 @@ func dataSourceGoogleRedisInstanceRead(d *schema.ResourceData, meta interface{}) return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/redis/data_source_redis_instance_test.go b/mmv1/third_party/terraform/services/redis/data_source_redis_instance_test.go index 0c03762b0021..35942e513aec 100644 --- a/mmv1/third_party/terraform/services/redis/data_source_redis_instance_test.go +++ b/mmv1/third_party/terraform/services/redis/data_source_redis_instance_test.go @@ -30,6 +30,10 @@ func testAccRedisInstanceDatasourceConfig(suffix string) string { resource "google_redis_instance" "redis" { name = "redis-test-%s" memory_size_gb = 1 + + labels = { + my-label = "my-label-value" + } } data "google_redis_instance" "redis" { diff --git a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project.go b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project.go index 03584ed4b02a..d5cd9c738087 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project.go +++ b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project.go @@ -42,6 +42,10 @@ func datasourceGoogleProjectRead(d *schema.ResourceData, meta interface{}) error return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found or not in ACTIVE state", id) } diff --git a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project_test.go b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project_test.go index 033ce759d4fb..513be054caaa 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project_test.go +++ b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_project_test.go @@ -41,6 +41,9 @@ resource "google_project" "project" { project_id = "%s" name = "%s" org_id = "%s" + labels = { + my-label = "my-label-value" + } } data "google_project" "project" { diff --git a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret.go b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret.go index a7a725dccfa5..007bd1e2a8f1 100644 --- a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret.go +++ b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret.go @@ -31,6 +31,14 @@ func dataSourceSecretManagerSecretRead(d *schema.ResourceData, meta interface{}) return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + + if err := tpgresource.SetDataSourceAnnotations(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret_test.go b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret_test.go index 839b498ebbfa..d175df4012a8 100644 --- a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret_test.go +++ b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secret_test.go @@ -25,7 +25,7 @@ func TestAccDataSourceSecretManagerSecret_basic(t *testing.T) { acctest.CheckDataSourceStateMatchesResourceStateWithIgnores( "data.google_secret_manager_secret.foo", "google_secret_manager_secret.bar", - map[string]struct{}{"zone": {}, "labels.%": {}, "terraform_labels.%": {}}, + map[string]struct{}{"zone": {}}, ), ), }, @@ -42,6 +42,10 @@ resource "google_secret_manager_secret" "bar" { label = "my-label" } + annotations = { + annotation = "my-annotation" + } + replication { user_managed { replicas { diff --git a/mmv1/third_party/terraform/services/spanner/data_source_spanner_instance.go b/mmv1/third_party/terraform/services/spanner/data_source_spanner_instance.go index 4c1fb9a0c563..afdbce7f040d 100644 --- a/mmv1/third_party/terraform/services/spanner/data_source_spanner_instance.go +++ b/mmv1/third_party/terraform/services/spanner/data_source_spanner_instance.go @@ -37,6 +37,10 @@ func dataSourceSpannerInstanceRead(d *schema.ResourceData, meta interface{}) err return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index.go b/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index.go index 8cd28fdb7044..8353f7598327 100644 --- a/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index.go +++ b/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index.go @@ -34,6 +34,10 @@ func dataSourceVertexAIIndexRead(d *schema.ResourceData, meta interface{}) error return err } + if err := tpgresource.SetDataSourceLabels(d); err != nil { + return err + } + if d.Id() == "" { return fmt.Errorf("%s not found", id) } diff --git a/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index_test.go b/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index_test.go index 5813d9adfc7b..a1e4b56bfd6e 100644 --- a/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/services/vertexai/data_source_vertex_ai_index_test.go @@ -31,8 +31,6 @@ func TestAccDataSourceVertexAIIndex_basic(t *testing.T) { map[string]struct{}{ "metadata.0.contents_delta_uri": {}, "metadata.0.is_complete_overwrite": {}, - "labels.%": {}, - "terraform_labels.%": {}, }, ), ), diff --git a/mmv1/third_party/terraform/tpgresource/labels.go b/mmv1/third_party/terraform/tpgresource/labels.go index c07cdfd486a5..b2986935cbf1 100644 --- a/mmv1/third_party/terraform/tpgresource/labels.go +++ b/mmv1/third_party/terraform/tpgresource/labels.go @@ -3,6 +3,7 @@ package tpgresource import ( "context" "fmt" + "log" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" @@ -27,6 +28,36 @@ func SetLabels(labels map[string]string, d *schema.ResourceData, lineage string) return d.Set(lineage, transformed) } +// Sets the "labels" field and "terraform_labels" with the value of the field "effective_labels" for data sources. +// When reading data source, as the labels field is unavailable in the configuration of the data source, +// the "labels" field will be empty. With this funciton, the labels "field" will have all of labels in the resource. +func SetDataSourceLabels(d *schema.ResourceData) error { + log.Printf("[INFO] SetDataSourceLabels d.id %s", d.Id()) + effectiveLabels := d.Get("effective_labels") + if effectiveLabels != nil { + if err := d.Set("labels", effectiveLabels); err != nil { + return fmt.Errorf("Error setting labels: %s", err) + } + if err := d.Set("terraform_labels", effectiveLabels); err != nil { + return fmt.Errorf("Error setting terraform_labels: %s", err) + } + } + return nil +} + +// Sets the "annotations" field with the value of the field "effective_annotations" for data sources. +// When reading data source, as the annotations field is unavailable in the configuration of the data source, +// the "annotations" field will be empty. With this funciton, the labels "annotations" will have all of annotations in the resource. +func SetDataSourceAnnotations(d *schema.ResourceData) error { + effectiveAnnotations := d.Get("effective_annotations") + if effectiveAnnotations != nil { + if err := d.Set("annotations", effectiveAnnotations); err != nil { + return fmt.Errorf("Error setting annotations: %s", err) + } + } + return nil +} + func SetLabelsDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { config := meta.(*transport_tpg.Config) diff --git a/mmv1/third_party/terraform/website/docs/d/cloudfunctions_function.html.markdown b/mmv1/third_party/terraform/website/docs/d/cloudfunctions_function.html.markdown index e3ca05447d0c..1b4e2f7dd5b2 100644 --- a/mmv1/third_party/terraform/website/docs/d/cloudfunctions_function.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/cloudfunctions_function.html.markdown @@ -49,7 +49,7 @@ exported: * `event_trigger` - A source that fires events in response to a condition in another service. Structure is [documented below](#nested_event_trigger). * `https_trigger_url` - If function is triggered by HTTP, trigger URL is set here. * `ingress_settings` - Controls what traffic can reach the function. -* `labels` - A map of labels applied to this function. +* `labels` - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. * `service_account_email` - The service account email to be assumed by the cloud function. * `vpc_connector` - The VPC Network Connector that this cloud function can connect to. * `vpc_connector_egress_settings` - The egress settings for the connector, controlling what traffic is diverted through it. diff --git a/mmv1/third_party/terraform/website/docs/d/compute_disk.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_disk.html.markdown index 65596b090bfa..33ad9dc772af 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_disk.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_disk.html.markdown @@ -82,7 +82,7 @@ In addition to the arguments listed above, the following computed attributes are * `description` - The optional description of this resource. -* `labels` - A map of labels applied to this disk. +* `labels` - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. * `size` - Size of the persistent disk, specified in GB. diff --git a/mmv1/third_party/terraform/website/docs/d/compute_image.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_image.html.markdown index e9cdc9616ad6..883e99fc0bfd 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_image.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_image.html.markdown @@ -71,7 +71,7 @@ exported: * `source_disk_id` - The ID value of the disk used to create this image. * `creation_timestamp` - The creation timestamp in RFC3339 text format. * `description` - An optional description of this image. -* `labels` - A map of labels applied to this image. +* `labels` - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. * `label_fingerprint` - A fingerprint for the labels being applied to this image. * `licenses` - A list of applicable license URI. * `status` - The status of the image. Possible values are **FAILED**, **PENDING**, or **READY**. diff --git a/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown index d478a3eca5ae..1d3e8dc06205 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown @@ -57,7 +57,7 @@ The following arguments are supported: * `guest_accelerator` - List of the type and count of accelerator cards attached to the instance. Structure is [documented below](#nested_guest_accelerator). -* `labels` - A set of key/value label pairs assigned to the instance. +* `labels` - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. * `metadata` - Metadata key/value pairs made available within the instance. diff --git a/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown index 2af65eaae691..ad42e0ed6c08 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown @@ -76,8 +76,7 @@ The following arguments are supported: * `instance_description` - A brief description to use for instances created from this template. -* `labels` - A set of key/value label pairs to assign to instances - created from this template, +* `labels` - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. * `metadata` - Metadata key/value pairs to make available from within instances created from this template. diff --git a/mmv1/third_party/terraform/website/docs/r/cloudfunctions_function.html.markdown b/mmv1/third_party/terraform/website/docs/r/cloudfunctions_function.html.markdown index 8d0ada5aa626..c73d6561aab6 100644 --- a/mmv1/third_party/terraform/website/docs/r/cloudfunctions_function.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/cloudfunctions_function.html.markdown @@ -134,6 +134,9 @@ Eg. `"nodejs16"`, `"python39"`, `"dotnet3"`, `"go116"`, `"java11"`, `"ruby30"`, * `labels` - (Optional) A set of key/value label pairs to assign to the function. Label keys must follow the requirements at https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements. +**Note**: This field is non-authoritative, and will only manage the labels present in your configuration. +Please refer to the field 'effective_labels' for all of the labels present on the resource. + * `terraform_labels` - The combination of labels configured directly on the resource and default labels configured on the provider. diff --git a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown index 792ff022fbb1..94c3fb60920d 100644 --- a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown @@ -262,6 +262,9 @@ The following arguments are supported: No more than 64 labels can be associated with a given environment. Both keys and values must be <= 128 bytes in size. + **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. + Please refer to the field 'effective_labels' for all of the labels present on the resource. + * `terraform_labels` - The combination of labels configured directly on the resource and default labels configured on the provider. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown index 53fc20e6a377..965f0d80a9d6 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown @@ -117,6 +117,8 @@ The following arguments are supported: For more details about this behavior, see [this section](https://www.terraform.io/docs/configuration/attr-as-blocks.html#defining-a-fixed-object-collection-value). * `labels` - (Optional) A map of key/value label pairs to assign to the instance. + **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. + Please refer to the field 'effective_labels' for all of the labels present on the resource. * `terraform_labels` - The combination of labels configured directly on the resource and default labels configured on the provider. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown index 2d08f340fb6f..49fe812e7a3f 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown @@ -306,6 +306,12 @@ The following arguments are supported: * `labels` - (Optional) A set of key/value label pairs to assign to instances created from this template. + **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. + Please refer to the field 'effective_labels' for all of the labels present on the resource. + +* `effective_labels` - + All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. + * `metadata` - (Optional) Metadata key/value pairs to make available from within instances created from this template. diff --git a/mmv1/third_party/terraform/website/docs/r/dataproc_job.html.markdown b/mmv1/third_party/terraform/website/docs/r/dataproc_job.html.markdown index 0e9953079fbe..84094a189b4a 100644 --- a/mmv1/third_party/terraform/website/docs/r/dataproc_job.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/dataproc_job.html.markdown @@ -102,6 +102,8 @@ output "pyspark_status" { job is first cancelled before issuing the delete. * `labels` - (Optional) The list of labels (key/value pairs) to add to the job. + **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. + Please refer to the field 'effective_labels' for all of the labels present on the resource. * `terraform_labels` - The combination of labels configured directly on the resource and default labels configured on the provider. diff --git a/mmv1/third_party/terraform/website/docs/r/google_project.html.markdown b/mmv1/third_party/terraform/website/docs/r/google_project.html.markdown index e5139412d01c..1f3a4dff8368 100644 --- a/mmv1/third_party/terraform/website/docs/r/google_project.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/google_project.html.markdown @@ -82,6 +82,8 @@ The following arguments are supported: without deleting the Project via the Google API. * `labels` - (Optional) A set of key/value label pairs to assign to the project. + **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. + Please refer to the field 'effective_labels' for all of the labels present on the resource. * `terraform_labels` - The combination of labels configured directly on the resource and default labels configured on the provider.