From b9de9629eafb4d1033ee1da516ca436c15614c3f Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Tue, 13 Aug 2024 15:00:46 -0700 Subject: [PATCH 1/7] Enable goog-terraform-provisioned provider label --- .../terraform/provider/provider.go.erb | 2 +- .../resource_clouddeploy_target_test.go | 80 ++++++++ .../resource_cloud_run_service_test.go.erb | 3 + .../resource_cloud_run_v2_service_test.go.erb | 22 +- .../compute/resource_compute_address_test.go | 64 ++++-- .../compute/resource_compute_disk_test.go.erb | 188 ++++++++++-------- ...source_compute_forwarding_rule_test.go.erb | 4 +- ...esource_compute_global_address_test.go.erb | 14 +- ...compute_global_forwarding_rule_test.go.erb | 4 +- .../resource_compute_image_test.go.erb | 22 +- ...urce_compute_instance_template_test.go.erb | 175 +++++++++------- .../resource_compute_instance_test.go.erb | 100 ++++++---- .../resource_compute_region_disk_test.go.erb | 21 +- ...mpute_region_instance_template_test.go.erb | 49 +++-- .../compute/resource_compute_snapshot_test.go | 4 +- .../guides/provider_reference.html.markdown | 5 +- .../guides/version_6_upgrade.html.markdown | 15 ++ 17 files changed, 484 insertions(+), 288 deletions(-) diff --git a/mmv1/third_party/terraform/provider/provider.go.erb b/mmv1/third_party/terraform/provider/provider.go.erb index 59a6b338d90a..3c4dce74acd3 100644 --- a/mmv1/third_party/terraform/provider/provider.go.erb +++ b/mmv1/third_party/terraform/provider/provider.go.erb @@ -135,6 +135,7 @@ func Provider() *schema.Provider { "add_terraform_attribution_label": { Type: schema.TypeBool, Optional: true, + Default: true, }, "terraform_attribution_label_addition_strategy": { @@ -328,7 +329,6 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr config.DefaultLabels[k] = v.(string) } - // Attribution label is opt-in; if unset, the default for AddTerraformAttributionLabel is false. config.AddTerraformAttributionLabel = d.Get("add_terraform_attribution_label").(bool) if config.AddTerraformAttributionLabel { config.TerraformAttributionLabelAdditionStrategy = transport_tpg.CreateOnlyAttributionStrategy diff --git a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_test.go b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_test.go index a5f87a96bace..881ab8ca3d5e 100644 --- a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_test.go +++ b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_test.go @@ -136,6 +136,7 @@ provider "google" { default_labels = { default_key1 = "default_value1" } + add_terraform_attribution_label = false } resource "google_clouddeploy_target" "primary" { @@ -175,6 +176,7 @@ provider "google" { default_labels = { default_key1 = "default_value1" } + add_terraform_attribution_label = false } resource "google_clouddeploy_target" "primary" { @@ -216,6 +218,7 @@ provider "google" { default_key1 = "default_value1" my_second_label = "example-label-2" } + add_terraform_attribution_label = false } resource "google_clouddeploy_target" "primary" { @@ -251,6 +254,10 @@ resource "google_clouddeploy_target" "primary" { func testAccClouddeployTarget_withoutLabels(context map[string]interface{}) string { return acctest.Nprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_clouddeploy_target" "primary" { location = "%{region}" name = "tf-test-target%{random_suffix}" @@ -277,6 +284,79 @@ resource "google_clouddeploy_target" "primary" { `, context) } +func TestAccClouddeployTarget_withAttributionDisabled(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_name": envvar.GetTestProjectFromEnv(), + "region": envvar.GetTestRegionFromEnv(), + "random_suffix": acctest.RandString(t, 10), + "add_attribution": "false", + "attribution_strategy": "CREATION_ONLY", + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckClouddeployTargetDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccClouddeployTarget_createWithAttribution(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "labels.%", "2"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "labels.my_first_label", "example-label-1"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "labels.my_second_label", "example-label-2"), + + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.%", "3"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.my_first_label", "example-label-1"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.my_second_label", "example-label-2"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.default_key1", "default_value1"), + + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "effective_labels.%", "3"), + ), + }, + { + ResourceName: "google_clouddeploy_target.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels", "annotations"}, + }, + { + Config: testAccClouddeployTarget_updateWithAttribution(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "labels.%", "2"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "labels.my_first_label", "example-label-updated-1"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "labels.my_second_label", "example-label-updated-2"), + + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.%", "3"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.my_first_label", "example-label-updated-1"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.my_second_label", "example-label-updated-2"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.default_key1", "default_value1"), + + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "effective_labels.%", "3"), + ), + }, + { + ResourceName: "google_clouddeploy_target.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels", "annotations"}, + }, + { + Config: testAccClouddeployTarget_clearWithAttribution(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckNoResourceAttr("google_clouddeploy_target.primary", "labels.%"), + + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.%", "1"), + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "terraform_labels.default_key1", "default_value1"), + + resource.TestCheckResourceAttr("google_clouddeploy_target.primary", "effective_labels.%", "1"), + ), + }, + }, + }) +} + func TestAccClouddeployTarget_withCreationOnlyAttribution(t *testing.T) { t.Parallel() diff --git a/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb b/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb index 3a15024c8ff7..23e874c2d65b 100644 --- a/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb @@ -630,6 +630,7 @@ provider "google" { default_labels = { default_key1 = "default_value1" } + add_terraform_attribution_label = false } resource "google_cloud_run_service" "default" { @@ -669,6 +670,7 @@ provider "google" { default_labels = { default_key1 = "default_value1" } + add_terraform_attribution_label = false } resource "google_cloud_run_service" "default" { @@ -710,6 +712,7 @@ provider "google" { default_key1 = "default_value1" env = "foo" } + add_terraform_attribution_label = false } resource "google_cloud_run_service" "default" { diff --git a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb index e9f3adf860d5..47b316958c3f 100644 --- a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb @@ -332,7 +332,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceTCPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, }, { Config: testAccCloudRunV2Service_cloudrunv2ServiceUpdateWithTCPStartupProbeAndHTTPLivenessProbe(context), @@ -341,7 +341,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceTCPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, }, }, }) @@ -366,7 +366,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceHTTPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, }, { Config: testAccCloudRunV2Service_cloudrunv2ServiceUpdateWithHTTPStartupProbe(context), @@ -375,7 +375,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceHTTPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, }, }, }) @@ -401,7 +401,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceGRPCProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceUpdateWithGRPCLivenessProbe(context), @@ -410,7 +410,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceGRPCProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, }, // The following test steps of gRPC startup probe are expected to fail with startup probe check failures. // This is because, due to the unavailability of ready-to-use container images of a gRPC service that @@ -726,7 +726,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceWithDirectVPCUpdate(t *testing.T) ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection", "terraform_labels"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceWithDirectVPCAndNamedBinAuthPolicyUpdate(context), @@ -735,7 +735,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceWithDirectVPCUpdate(t *testing.T) ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection", "terraform_labels"}, }, }, }) @@ -805,7 +805,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceCustomAudienceUpdate(t *testing.T ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection", "terraform_labels"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceUpdateWithCustomAudience(serviceName, "test_update"), @@ -814,7 +814,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceCustomAudienceUpdate(t *testing.T ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection", "terraform_labels"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceUpdateWithoutCustomAudience(serviceName), @@ -823,7 +823,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceCustomAudienceUpdate(t *testing.T ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection", "terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go index e9865fdce86a..5705479c138b 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go @@ -37,21 +37,24 @@ func TestAccComputeAddress_internal(t *testing.T) { Config: testAccComputeAddress_internal(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_address.internal", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_address.internal", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { - ResourceName: "google_compute_address.internal_with_subnet", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_address.internal_with_subnet", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { - ResourceName: "google_compute_address.internal_with_subnet_and_address", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_address.internal_with_subnet_and_address", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -73,9 +76,10 @@ func TestAccComputeAddress_networkTier_withLabels(t *testing.T) { ), }, { - ResourceName: "google_compute_address.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_address.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeAddress_networkTier_withLabels(acctest.RandString(t, 10)), @@ -123,9 +127,10 @@ func TestAccComputeAddress_networkTier_withLabels(t *testing.T) { ), }, { - ResourceName: "google_compute_address.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_address.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -269,9 +274,10 @@ func TestAccComputeAddress_withProviderDefaultLabels(t *testing.T) { ), }, { - ResourceName: "google_compute_address.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_address.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -524,6 +530,10 @@ func TestAccComputeAddress_withAttributionRemoved(t *testing.T) { func testAccComputeAddress_networkTier_withLabels(i string) string { return fmt.Sprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_compute_address" "foobar" { name = "tf-test-address-%s" network_tier = "STANDARD" @@ -538,6 +548,10 @@ resource "google_compute_address" "foobar" { func testAccComputeAddress_networkTier_withLabelsUpdate(i string) string { return fmt.Sprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_compute_address" "foobar" { name = "tf-test-address-%s" network_tier = "STANDARD" @@ -556,6 +570,7 @@ provider "google" { default_labels = { default_key1 = "default_value1" } + add_terraform_attribution_label = false } resource "google_compute_address" "foobar" { @@ -576,6 +591,7 @@ provider "google" { default_labels = { default_key1 = "default_value1" } + add_terraform_attribution_label = false } resource "google_compute_address" "foobar" { @@ -598,6 +614,7 @@ provider "google" { default_key1 = "default_value1" env = "foo" } + add_terraform_attribution_label = false } resource "google_compute_address" "foobar" { @@ -748,6 +765,10 @@ resource "google_compute_address" "internal_with_subnet_and_address" { func testAccComputeAddress_networkTier(i string) string { return fmt.Sprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_compute_address" "foobar" { name = "tf-test-address-%s" network_tier = "STANDARD" @@ -765,9 +786,10 @@ func TestAccComputeAddress_internalIpv6(t *testing.T) { Config: testAccComputeAddress_internalIpv6(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_address.ipv6", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_address.ipv6", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb index bf6e2a95771d..b0c0c4926442 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb @@ -448,25 +448,28 @@ func TestAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(t *testing.T) { Config: testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context_1), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context_2), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context_3), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -500,25 +503,28 @@ func TestAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(t *testing.T) Config: testAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(context_1), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(context_2), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(context_3), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -541,17 +547,19 @@ func TestAccComputeDisk_fromSnapshot(t *testing.T) { Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "self_link"), }, { - ResourceName: "google_compute_disk.seconddisk", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.seconddisk", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "name"), }, { - ResourceName: "google_compute_disk.seconddisk", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.seconddisk", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -609,10 +617,11 @@ func TestAccComputeDisk_encryptionKMS(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportStateId: importID, - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportStateId: importID, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -649,9 +658,10 @@ func TestAccComputeDisk_pdHyperDiskEnableConfidentialCompute(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -672,9 +682,10 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) { Config: testAccComputeDisk_deleteDetach(instanceName, diskName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, // this needs to be a second step so we refresh and see the instance // listed as attached to the disk; the instance is created after the @@ -684,9 +695,10 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) { Config: testAccComputeDisk_deleteDetach(instanceName, diskName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -710,9 +722,10 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, // this needs to be a second step so we refresh and see the instance // listed as attached to the disk; the instance is created after the @@ -722,27 +735,30 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, // Change the disk name to recreate the instances { Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, // Add the extra step like before { Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -761,9 +777,10 @@ func TestAccComputeDisk_pdExtremeImplicitProvisionedIops(t *testing.T) { Config: testAccComputeDisk_pdExtremeImplicitProvisionedIops(diskName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -784,9 +801,10 @@ func TestAccComputeDisk_resourcePolicies(t *testing.T) { Config: testAccComputeDisk_resourcePolicies(diskName, policyName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -808,17 +826,19 @@ func TestAccComputeDisk_updateResourcePolicies(t *testing.T) { Config: testAccComputeDisk_resourcePolicies(diskName, policyName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeDisk_updateResourcePolicies(diskName, policyName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -839,9 +859,10 @@ func TestAccComputeDisk_multiWriter(t *testing.T) { Config: testAccComputeDisk_multiWriter(instanceName, diskName, true), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -915,9 +936,9 @@ func TestAccComputeDisk_cloneDisk(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.disk-clone", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.disk-clone", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, }, @@ -937,18 +958,18 @@ func TestAccComputeDisk_featuresUpdated(t *testing.T) { Config: testAccComputeDisk_features(diskName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, { Config: testAccComputeDisk_featuresUpdated(diskName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, }, @@ -1633,9 +1654,10 @@ func TestAccComputeDisk_storagePoolSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1739,9 +1761,10 @@ func TestAccComputeDisk_accessModeSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, // Update Access Mode { @@ -1751,9 +1774,10 @@ func TestAccComputeDisk_accessModeSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb index 9fec2008553c..2a91e67eb9c6 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb @@ -97,7 +97,7 @@ func TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(t ResourceName: "google_compute_forwarding_rule.google_compute_forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region"}, + ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region", "terraform_labels"}, }, { Config: testAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(context), @@ -106,7 +106,7 @@ func TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(t ResourceName: "google_compute_forwarding_rule.google_compute_forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region"}, + ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region", "terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb index d7f2b3fba139..1b7454829762 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb @@ -21,9 +21,10 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) { Config: testAccComputeGlobalAddress_ipv6(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_global_address.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_global_address.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -41,9 +42,10 @@ func TestAccComputeGlobalAddress_internal(t *testing.T) { Config: testAccComputeGlobalAddress_internal(acctest.RandString(t, 10), acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_global_address.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_global_address.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb index 1a638d1aa2bf..b4340836d4d7 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb @@ -149,7 +149,7 @@ func TestAccComputeGlobalForwardingRule_internalLoadBalancing(t *testing.T) { ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "target"}, + ImportStateVerifyIgnore: []string{"port_range", "target", "terraform_labels"}, }, { Config: testAccComputeGlobalForwardingRule_internalLoadBalancingUpdate(fr, proxy, backend, hc, urlmap, igm, it), @@ -158,7 +158,7 @@ func TestAccComputeGlobalForwardingRule_internalLoadBalancing(t *testing.T) { ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "target"}, + ImportStateVerifyIgnore: []string{"port_range", "target", "terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb index 6ed5430ec8c1..d14ee93109fe 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb @@ -99,9 +99,10 @@ func TestAccComputeImage_basedondisk(t *testing.T) { ), }, { - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -127,9 +128,10 @@ func TestAccComputeImage_sourceImage(t *testing.T) { ), }, { - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -158,9 +160,10 @@ func TestAccComputeImage_sourceSnapshot(t *testing.T) { ), }, { - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -239,6 +242,7 @@ func TestAccComputeImage_imageEncryptionKey(t *testing.T) { ResourceName: "google_compute_image.image", ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb index f84d7330e8c3..0a9e2ff82a26 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb @@ -112,9 +112,10 @@ func TestAccComputeInstanceTemplate_preemptible(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -177,9 +178,10 @@ func TestAccComputeInstanceTemplate_IP(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -203,9 +205,10 @@ func TestAccComputeInstanceTemplate_IPv6(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -223,9 +226,10 @@ func TestAccComputeInstanceTemplate_networkTier(t *testing.T) { Config: testAccComputeInstanceTemplate_networkTier(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -253,9 +257,10 @@ func TestAccComputeInstanceTemplate_networkIP(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -283,9 +288,10 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -303,9 +309,10 @@ func TestAccComputeInstanceTemplate_disks(t *testing.T) { Config: testAccComputeInstanceTemplate_disks(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -339,9 +346,10 @@ func TestAccComputeInstanceTemplate_regionDisks(t *testing.T) { Config: testAccComputeInstanceTemplate_regionDisks(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -359,9 +367,10 @@ func TestAccComputeInstanceTemplate_diskIops(t *testing.T) { Config: testAccComputeInstanceTemplate_diskIops(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -490,9 +499,10 @@ func TestAccComputeInstanceTemplate_primaryAliasIpRange(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -516,9 +526,10 @@ func TestAccComputeInstanceTemplate_secondaryAliasIpRange(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -542,9 +553,10 @@ func TestAccComputeInstanceTemplate_guestAccelerator(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -591,9 +603,10 @@ func TestAccComputeInstanceTemplate_minCpuPlatform(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -617,9 +630,9 @@ func TestAccComputeInstanceTemplate_EncryptKMS(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, }, @@ -638,9 +651,10 @@ func TestAccComputeInstanceTemplate_soleTenantNodeAffinities(t *testing.T) { Config: testAccComputeInstanceTemplate_soleTenantInstanceTemplate(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -665,9 +679,10 @@ func TestAccComputeInstanceTemplate_instanceResourcePolicies(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -742,9 +757,10 @@ func TestAccComputeInstanceTemplate_shieldedVmConfig1(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -768,9 +784,10 @@ func TestAccComputeInstanceTemplate_shieldedVmConfig2(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -851,9 +868,10 @@ func TestAccComputeInstanceTemplate_enableDisplay(t *testing.T) { Config: testAccComputeInstanceTemplate_enableDisplay(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -928,7 +946,7 @@ func TestAccComputeInstanceTemplate_withScratchDisk(t *testing.T) { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix"}, + ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, }, }, }) @@ -1188,9 +1206,10 @@ func TestAccComputeInstanceTemplate_spot_maxRunDuration_stopTerminationAction(t ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1222,9 +1241,10 @@ func TestAccComputeInstanceTemplate_maxRunDuration_onInstanceStopAction(t *testi ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1259,9 +1279,10 @@ func TestAccComputeInstanceTemplate_spot_maxRunDuration(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1290,9 +1311,10 @@ func TestAccComputeInstanceTemplate_localSsdRecoveryTimeout(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1327,7 +1349,7 @@ func TestAccComputeInstanceTemplate_partnerMetadata(t *testing.T) { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace)}, + ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace), "terraform_labels"}, }, }, }) @@ -1364,7 +1386,7 @@ func TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey(t *testing.T) { ResourceName: "google_compute_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key"}, + ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key", "terraform_labels"}, }, }, }) @@ -1398,7 +1420,7 @@ func TestAccComputeInstanceTemplate_sourceImageEncryptionKey(t *testing.T) { ResourceName: "google_compute_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key"}, + ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key", "terraform_labels"}, }, }, }) @@ -1437,9 +1459,10 @@ func TestAccComputeInstanceTemplate_NetworkAttachment(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb index cc035b02e98f..be810fdea362 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb @@ -161,7 +161,7 @@ func computeInstanceImportStep(zone, instanceName string, additionalImportIgnore // metadata is only read into state if set in the config // importing doesn't know whether metadata.startup_script vs metadata_startup_script is set in the config, // it always takes metadata.startup-script - ignores := []string{"metadata.%", "metadata.startup-script", "metadata_startup_script", "boot_disk.0.initialize_params.0.resource_manager_tags.%", "params.0.resource_manager_tags.%"} + ignores := []string{"metadata.%", "metadata.startup-script", "metadata_startup_script", "boot_disk.0.initialize_params.0.resource_manager_tags.%", "params.0.resource_manager_tags.%", "terraform_labels"} return resource.TestStep{ ResourceName: "google_compute_instance.foobar", @@ -440,9 +440,10 @@ func TestAccComputeInstance_IPv6(t *testing.T) { ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -3316,9 +3317,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigs(t *test ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -3343,9 +3345,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithEmptyAndNullSecurityPoli ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -3372,9 +3375,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance.self_link", "google_compute_region_security_policy.policyforinstance2.self_link"), @@ -3385,9 +3389,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -3449,9 +3454,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPoliciesRemoveAccessConfig(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance.self_link", "google_compute_region_security_policy.policyforinstance.self_link"), @@ -3462,9 +3468,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -3490,9 +3497,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance.self_link", "google_compute_region_security_policy.policyforinstance2.self_link"), @@ -3504,9 +3512,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance2.self_link", "google_compute_region_security_policy.policyforinstance.self_link"), @@ -3518,9 +3527,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "\"\"", "\"\""), @@ -3531,9 +3541,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -3559,9 +3570,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithAccessConfigUpdateAccess ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigsUpdateAccessConfig(suffix, policyName, instanceName), @@ -3572,9 +3584,10 @@ func testAccComputeInstance_nic_securityPolicyCreateWithAccessConfigUpdateAccess ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigsRemoveAccessConfig(suffix, policyName, instanceName), @@ -10041,9 +10054,10 @@ func TestAccComputeInstance_bootDisk_storagePoolSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb index aceaea4f6ade..e836fc83d2bb 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb @@ -209,9 +209,10 @@ func TestAccComputeRegionDisk_cloneDisk(t *testing.T) { ), }, { - ResourceName: "google_compute_region_disk.regiondisk-clone", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_disk.regiondisk-clone", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -237,17 +238,19 @@ func TestAccComputeRegionDisk_featuresUpdated(t *testing.T) { ), }, { - ResourceName: "google_compute_region_disk.regiondisk", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_disk.regiondisk", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, { Config: testAccComputeRegionDisk_featuresUpdated(diskName), }, { - ResourceName: "google_compute_region_disk.regiondisk", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_disk.regiondisk", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb index 7674b32c2d3e..62be8724cf2c 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb @@ -761,9 +761,10 @@ func TestAccComputeRegionInstanceTemplate_enableDisplay(t *testing.T) { Config: testAccComputeRegionInstanceTemplate_enableDisplay(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -838,7 +839,7 @@ func TestAccComputeRegionInstanceTemplate_withScratchDisk(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix"}, + ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, }, }, }) @@ -858,7 +859,7 @@ func TestAccComputeRegionInstanceTemplate_with18TbScratchDisk(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix"}, + ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, }, }, }) @@ -885,7 +886,7 @@ func TestAccComputeRegionInstanceTemplate_imageResourceTest(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix"}, + ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, }, { Config: testAccComputeRegionInstanceTemplate_imageResourceTest(diskName, computeImage, imageDesc2), @@ -894,7 +895,7 @@ func TestAccComputeRegionInstanceTemplate_imageResourceTest(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix"}, + ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, }, }, }) @@ -1026,9 +1027,10 @@ func TestAccComputeRegionInstanceTemplate_spot(t *testing.T) { ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1061,9 +1063,10 @@ func TestAccComputeRegionInstanceTemplate_spot_maxRunDuration(t *testing.T) { ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1094,9 +1097,10 @@ func TestAccComputeRegionInstanceTemplate_maxRunDuration_onInstanceStopAction(t ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1125,9 +1129,10 @@ func TestAccComputeRegionInstanceTemplate_localSsdRecoveryTimeout(t *testing.T) ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) @@ -1161,7 +1166,7 @@ func TestAccComputeRegionalInstanceTemplate_partnerMetadata(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace)}, + ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace), "terraform_labels"}, }, }, }) @@ -1198,7 +1203,7 @@ func TestAccComputeRegionInstanceTemplate_sourceSnapshotEncryptionKey(t *testing ResourceName: "google_compute_region_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key"}, + ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key", "terraform_labels"}, }, }, }) @@ -1232,7 +1237,7 @@ func TestAccComputeRegionInstanceTemplate_sourceImageEncryptionKey(t *testing.T) ResourceName: "google_compute_region_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key"}, + ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key", "terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go index 5d9c79c1c50a..6997f65f9a19 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go @@ -26,7 +26,7 @@ func TestAccComputeSnapshot_encryption(t *testing.T) { ResourceName: "google_compute_snapshot.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"snapshot_encryption_key", "source_disk", "source_disk_encryption_key", "zone"}, + ImportStateVerifyIgnore: []string{"snapshot_encryption_key", "source_disk", "source_disk_encryption_key", "zone", "terraform_labels"}, }, }, }) @@ -52,7 +52,7 @@ func TestAccComputeSnapshot_encryptionCMEK(t *testing.T) { ResourceName: "google_compute_snapshot.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zone", "snapshot_encryption_key", "source_disk_encryption_key"}, + ImportStateVerifyIgnore: []string{"zone", "snapshot_encryption_key", "source_disk_encryption_key", "terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown b/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown index 8b03ef435035..9adb671d0aeb 100644 --- a/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown @@ -277,8 +277,9 @@ automatically to resources, and will be returned in the `terraform_labels` and `effective_labels` fields. This makes it possible to distinguish Terraform resources when using other tools like Cloud Console or gcloud. -The default value is `false`. No label will be added unless the provider is -explicitly configured to do so by setting the value to `true`. +The default value is `true`. Unless explicitly configured (along with +`terraform_attribution_label_addition_strategy`, described below) the label +be added to newly provisioned resources. --- diff --git a/mmv1/third_party/terraform/website/docs/guides/version_6_upgrade.html.markdown b/mmv1/third_party/terraform/website/docs/guides/version_6_upgrade.html.markdown index bb876936834b..26b5655f54d8 100644 --- a/mmv1/third_party/terraform/website/docs/guides/version_6_upgrade.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/version_6_upgrade.html.markdown @@ -97,6 +97,21 @@ Previously, the max length of `name_prefix` was 37 characters since the autogene the total max length for names of 63 characters. In 6.0, providing a `name_prefix` larger than 37 characters will prompt the provider to use a shortened suffix of only 9 characters, leading to a new max of 54 characters for `name_prefix`. This shortened suffix is inevitably more prone to collisions, so use the longer max `name_prefix` length with caution. +### Provider attribution label is enabled by default + +Version 5.0.0 introduced the `goog-terraform-provisioned = true` label that could +be automatically added to resources, making it easy to identify resources created +by the provider when using other tools such as `gcloud` or the GCP web console. In +5.0.0 the label needed to be enabled explicitly; in 6.0.0 the default is to add the +label to all newly created resources. This behavior can be disabled in the provider +configuration. For example: + +```hcl +provider "google" { + add_terraform_attribution_label = false +} +``` + ## Datasources ## Datasource: `google_product_datasource` From 87b0d03b9c949d73d60827c575ae8a4489d0d658 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Wed, 14 Aug 2024 11:25:02 -0700 Subject: [PATCH 2/7] Add terraform_labels to ImportStateVerifyIgnore at the VCR test level --- .../terraform/acctest/vcr_utils.go | 15 +++++++++++++ .../resource_cloud_run_v2_service_test.go.erb | 22 +++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/mmv1/third_party/terraform/acctest/vcr_utils.go b/mmv1/third_party/terraform/acctest/vcr_utils.go index feea805d5999..a90c24fcc3a0 100644 --- a/mmv1/third_party/terraform/acctest/vcr_utils.go +++ b/mmv1/third_party/terraform/acctest/vcr_utils.go @@ -14,6 +14,7 @@ import ( "path/filepath" "reflect" "regexp" + "slices" "strconv" "strings" "sync" @@ -147,6 +148,20 @@ func VcrTest(t *testing.T, c resource.TestCase) { } else if isReleaseDiffEnabled() { c = initializeReleaseDiffTest(c, t.Name()) } + + // terraform_labels is a computed field to which "goog-terraform-provisioned": "true" is always + // added by the provider. ImportStateVerify "checks for strict equality and does not respect + // DiffSuppressFunc or CustomizeDiff" so any test using ImportStateVerify must ignore + // terraform_labels. + var steps []resource.TestStep + for _, s := range c.Steps { + if s.ImportStateVerify && !slices.Contains(s.ImportStateVerifyIgnore, "terraform_labels") { + s.ImportStateVerifyIgnore = append(s.ImportStateVerifyIgnore, "terraform_labels") + } + steps = append(steps, s) + } + c.Steps = steps + resource.Test(t, c) } diff --git a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb index 47b316958c3f..e9f3adf860d5 100644 --- a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb @@ -332,7 +332,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceTCPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, }, { Config: testAccCloudRunV2Service_cloudrunv2ServiceUpdateWithTCPStartupProbeAndHTTPLivenessProbe(context), @@ -341,7 +341,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceTCPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, }, }, }) @@ -366,7 +366,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceHTTPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, }, { Config: testAccCloudRunV2Service_cloudrunv2ServiceUpdateWithHTTPStartupProbe(context), @@ -375,7 +375,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceHTTPProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, }, }, }) @@ -401,7 +401,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceGRPCProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceUpdateWithGRPCLivenessProbe(context), @@ -410,7 +410,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceGRPCProbesUpdate(t *testing.T) { ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "deletion_protection"}, }, // The following test steps of gRPC startup probe are expected to fail with startup probe check failures. // This is because, due to the unavailability of ready-to-use container images of a gRPC service that @@ -726,7 +726,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceWithDirectVPCUpdate(t *testing.T) ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceWithDirectVPCAndNamedBinAuthPolicyUpdate(context), @@ -735,7 +735,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceWithDirectVPCUpdate(t *testing.T) ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "deletion_protection"}, }, }, }) @@ -805,7 +805,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceCustomAudienceUpdate(t *testing.T ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceUpdateWithCustomAudience(serviceName, "test_update"), @@ -814,7 +814,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceCustomAudienceUpdate(t *testing.T ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection"}, }, { Config: testAccCloudRunV2Service_cloudRunServiceUpdateWithoutCustomAudience(serviceName), @@ -823,7 +823,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceCustomAudienceUpdate(t *testing.T ResourceName: "google_cloud_run_v2_service.default", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name", "location", "annotations", "launch_stage", "deletion_protection"}, }, }, }) From 9aa1650e555214711c642fbf6cbbaeff7adadd82 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 15 Aug 2024 16:03:33 -0700 Subject: [PATCH 3/7] Extend CI timeout and revert unassociated test changes --- .ci/gcb-generate-diffs-new.yml | 2 +- .../compute/resource_compute_address_test.go | 49 ++--- .../compute/resource_compute_disk_test.go.erb | 188 ++++++++---------- ...source_compute_forwarding_rule_test.go.erb | 4 +- ...esource_compute_global_address_test.go.erb | 14 +- ...compute_global_forwarding_rule_test.go.erb | 4 +- .../resource_compute_image_test.go.erb | 22 +- ...urce_compute_instance_template_test.go.erb | 175 +++++++--------- .../resource_compute_instance_test.go.erb | 100 ++++------ .../resource_compute_region_disk_test.go.erb | 21 +- ...mpute_region_instance_template_test.go.erb | 49 ++--- .../compute/resource_compute_snapshot_test.go | 4 +- 12 files changed, 275 insertions(+), 357 deletions(-) diff --git a/.ci/gcb-generate-diffs-new.yml b/.ci/gcb-generate-diffs-new.yml index ba33d4e0a6a4..fbe1d8170ce6 100644 --- a/.ci/gcb-generate-diffs-new.yml +++ b/.ci/gcb-generate-diffs-new.yml @@ -281,7 +281,7 @@ steps: - COMMIT_SHA=$COMMIT_SHA # Long timeout to enable waiting on VCR test -timeout: 20000s +timeout: 64800s options: machineType: 'N1_HIGHCPU_32' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go index 5705479c138b..dfcf8c609102 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_address_test.go @@ -37,24 +37,21 @@ func TestAccComputeAddress_internal(t *testing.T) { Config: testAccComputeAddress_internal(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_address.internal", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_address.internal", + ImportState: true, + ImportStateVerify: true, }, { - ResourceName: "google_compute_address.internal_with_subnet", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_address.internal_with_subnet", + ImportState: true, + ImportStateVerify: true, }, { - ResourceName: "google_compute_address.internal_with_subnet_and_address", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_address.internal_with_subnet_and_address", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -76,10 +73,9 @@ func TestAccComputeAddress_networkTier_withLabels(t *testing.T) { ), }, { - ResourceName: "google_compute_address.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_address.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeAddress_networkTier_withLabels(acctest.RandString(t, 10)), @@ -127,10 +123,9 @@ func TestAccComputeAddress_networkTier_withLabels(t *testing.T) { ), }, { - ResourceName: "google_compute_address.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_address.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -274,10 +269,9 @@ func TestAccComputeAddress_withProviderDefaultLabels(t *testing.T) { ), }, { - ResourceName: "google_compute_address.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_address.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -786,10 +780,9 @@ func TestAccComputeAddress_internalIpv6(t *testing.T) { Config: testAccComputeAddress_internalIpv6(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_address.ipv6", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_address.ipv6", + ImportState: true, + ImportStateVerify: true, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb index b0c0c4926442..bf6e2a95771d 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.erb @@ -448,28 +448,25 @@ func TestAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(t *testing.T) { Config: testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context_1), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context_2), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedIopsLifeCycle(context_3), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -503,28 +500,25 @@ func TestAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(t *testing.T) Config: testAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(context_1), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(context_2), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeDisk_pdHyperDiskProvisionedThroughputLifeCycle(context_3), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -547,19 +541,17 @@ func TestAccComputeDisk_fromSnapshot(t *testing.T) { Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "self_link"), }, { - ResourceName: "google_compute_disk.seconddisk", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.seconddisk", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "name"), }, { - ResourceName: "google_compute_disk.seconddisk", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.seconddisk", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -617,11 +609,10 @@ func TestAccComputeDisk_encryptionKMS(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportStateId: importID, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportStateId: importID, + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -658,10 +649,9 @@ func TestAccComputeDisk_pdHyperDiskEnableConfidentialCompute(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -682,10 +672,9 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) { Config: testAccComputeDisk_deleteDetach(instanceName, diskName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, }, // this needs to be a second step so we refresh and see the instance // listed as attached to the disk; the instance is created after the @@ -695,10 +684,9 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) { Config: testAccComputeDisk_deleteDetach(instanceName, diskName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -722,10 +710,9 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, }, // this needs to be a second step so we refresh and see the instance // listed as attached to the disk; the instance is created after the @@ -735,30 +722,27 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) { Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, }, // Change the disk name to recreate the instances { Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, }, // Add the extra step like before { Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName), }, { - ResourceName: "google_compute_disk.foo", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foo", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -777,10 +761,9 @@ func TestAccComputeDisk_pdExtremeImplicitProvisionedIops(t *testing.T) { Config: testAccComputeDisk_pdExtremeImplicitProvisionedIops(diskName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -801,10 +784,9 @@ func TestAccComputeDisk_resourcePolicies(t *testing.T) { Config: testAccComputeDisk_resourcePolicies(diskName, policyName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -826,19 +808,17 @@ func TestAccComputeDisk_updateResourcePolicies(t *testing.T) { Config: testAccComputeDisk_resourcePolicies(diskName, policyName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeDisk_updateResourcePolicies(diskName, policyName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -859,10 +839,9 @@ func TestAccComputeDisk_multiWriter(t *testing.T) { Config: testAccComputeDisk_multiWriter(instanceName, diskName, true), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -936,9 +915,9 @@ func TestAccComputeDisk_cloneDisk(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.disk-clone", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.disk-clone", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, }, @@ -958,18 +937,18 @@ func TestAccComputeDisk_featuresUpdated(t *testing.T) { Config: testAccComputeDisk_features(diskName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, { Config: testAccComputeDisk_featuresUpdated(diskName), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, }, @@ -1654,10 +1633,9 @@ func TestAccComputeDisk_storagePoolSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1761,10 +1739,9 @@ func TestAccComputeDisk_accessModeSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, // Update Access Mode { @@ -1774,10 +1751,9 @@ func TestAccComputeDisk_accessModeSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_disk.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb index 2a91e67eb9c6..9fec2008553c 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_forwarding_rule_test.go.erb @@ -97,7 +97,7 @@ func TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(t ResourceName: "google_compute_forwarding_rule.google_compute_forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region"}, }, { Config: testAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(context), @@ -106,7 +106,7 @@ func TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExampleUpdate(t ResourceName: "google_compute_forwarding_rule.google_compute_forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"backend_service", "network", "subnetwork", "region"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb index 1b7454829762..d7f2b3fba139 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_global_address_test.go.erb @@ -21,10 +21,9 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) { Config: testAccComputeGlobalAddress_ipv6(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_global_address.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_global_address.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -42,10 +41,9 @@ func TestAccComputeGlobalAddress_internal(t *testing.T) { Config: testAccComputeGlobalAddress_internal(acctest.RandString(t, 10), acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_global_address.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_global_address.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb index b4340836d4d7..1a638d1aa2bf 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.erb @@ -149,7 +149,7 @@ func TestAccComputeGlobalForwardingRule_internalLoadBalancing(t *testing.T) { ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "target", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"port_range", "target"}, }, { Config: testAccComputeGlobalForwardingRule_internalLoadBalancingUpdate(fr, proxy, backend, hc, urlmap, igm, it), @@ -158,7 +158,7 @@ func TestAccComputeGlobalForwardingRule_internalLoadBalancing(t *testing.T) { ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "target", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"port_range", "target"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb index d14ee93109fe..6ed5430ec8c1 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_image_test.go.erb @@ -99,10 +99,9 @@ func TestAccComputeImage_basedondisk(t *testing.T) { ), }, { - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -128,10 +127,9 @@ func TestAccComputeImage_sourceImage(t *testing.T) { ), }, { - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -160,10 +158,9 @@ func TestAccComputeImage_sourceSnapshot(t *testing.T) { ), }, { - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -242,7 +239,6 @@ func TestAccComputeImage_imageEncryptionKey(t *testing.T) { ResourceName: "google_compute_image.image", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb index 0a9e2ff82a26..f84d7330e8c3 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.erb @@ -112,10 +112,9 @@ func TestAccComputeInstanceTemplate_preemptible(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -178,10 +177,9 @@ func TestAccComputeInstanceTemplate_IP(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -205,10 +203,9 @@ func TestAccComputeInstanceTemplate_IPv6(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -226,10 +223,9 @@ func TestAccComputeInstanceTemplate_networkTier(t *testing.T) { Config: testAccComputeInstanceTemplate_networkTier(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -257,10 +253,9 @@ func TestAccComputeInstanceTemplate_networkIP(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -288,10 +283,9 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -309,10 +303,9 @@ func TestAccComputeInstanceTemplate_disks(t *testing.T) { Config: testAccComputeInstanceTemplate_disks(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -346,10 +339,9 @@ func TestAccComputeInstanceTemplate_regionDisks(t *testing.T) { Config: testAccComputeInstanceTemplate_regionDisks(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -367,10 +359,9 @@ func TestAccComputeInstanceTemplate_diskIops(t *testing.T) { Config: testAccComputeInstanceTemplate_diskIops(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -499,10 +490,9 @@ func TestAccComputeInstanceTemplate_primaryAliasIpRange(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -526,10 +516,9 @@ func TestAccComputeInstanceTemplate_secondaryAliasIpRange(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -553,10 +542,9 @@ func TestAccComputeInstanceTemplate_guestAccelerator(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -603,10 +591,9 @@ func TestAccComputeInstanceTemplate_minCpuPlatform(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -630,9 +617,9 @@ func TestAccComputeInstanceTemplate_EncryptKMS(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, }, @@ -651,10 +638,9 @@ func TestAccComputeInstanceTemplate_soleTenantNodeAffinities(t *testing.T) { Config: testAccComputeInstanceTemplate_soleTenantInstanceTemplate(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -679,10 +665,9 @@ func TestAccComputeInstanceTemplate_instanceResourcePolicies(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -757,10 +742,9 @@ func TestAccComputeInstanceTemplate_shieldedVmConfig1(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -784,10 +768,9 @@ func TestAccComputeInstanceTemplate_shieldedVmConfig2(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -868,10 +851,9 @@ func TestAccComputeInstanceTemplate_enableDisplay(t *testing.T) { Config: testAccComputeInstanceTemplate_enableDisplay(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -946,7 +928,7 @@ func TestAccComputeInstanceTemplate_withScratchDisk(t *testing.T) { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name_prefix"}, }, }, }) @@ -1206,10 +1188,9 @@ func TestAccComputeInstanceTemplate_spot_maxRunDuration_stopTerminationAction(t ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1241,10 +1222,9 @@ func TestAccComputeInstanceTemplate_maxRunDuration_onInstanceStopAction(t *testi ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1279,10 +1259,9 @@ func TestAccComputeInstanceTemplate_spot_maxRunDuration(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1311,10 +1290,9 @@ func TestAccComputeInstanceTemplate_localSsdRecoveryTimeout(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1349,7 +1327,7 @@ func TestAccComputeInstanceTemplate_partnerMetadata(t *testing.T) { ResourceName: "google_compute_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace), "terraform_labels"}, + ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace)}, }, }, }) @@ -1386,7 +1364,7 @@ func TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey(t *testing.T) { ResourceName: "google_compute_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key"}, }, }, }) @@ -1420,7 +1398,7 @@ func TestAccComputeInstanceTemplate_sourceImageEncryptionKey(t *testing.T) { ResourceName: "google_compute_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key"}, }, }, }) @@ -1459,10 +1437,9 @@ func TestAccComputeInstanceTemplate_NetworkAttachment(t *testing.T) { ), }, { - ResourceName: "google_compute_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb index be810fdea362..cc035b02e98f 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb @@ -161,7 +161,7 @@ func computeInstanceImportStep(zone, instanceName string, additionalImportIgnore // metadata is only read into state if set in the config // importing doesn't know whether metadata.startup_script vs metadata_startup_script is set in the config, // it always takes metadata.startup-script - ignores := []string{"metadata.%", "metadata.startup-script", "metadata_startup_script", "boot_disk.0.initialize_params.0.resource_manager_tags.%", "params.0.resource_manager_tags.%", "terraform_labels"} + ignores := []string{"metadata.%", "metadata.startup-script", "metadata_startup_script", "boot_disk.0.initialize_params.0.resource_manager_tags.%", "params.0.resource_manager_tags.%"} return resource.TestStep{ ResourceName: "google_compute_instance.foobar", @@ -440,10 +440,9 @@ func TestAccComputeInstance_IPv6(t *testing.T) { ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -3317,10 +3316,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigs(t *test ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -3345,10 +3343,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithEmptyAndNullSecurityPoli ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -3375,10 +3372,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance.self_link", "google_compute_region_security_policy.policyforinstance2.self_link"), @@ -3389,10 +3385,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -3454,10 +3449,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPoliciesRemoveAccessConfig(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance.self_link", "google_compute_region_security_policy.policyforinstance.self_link"), @@ -3468,10 +3462,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -3497,10 +3490,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance.self_link", "google_compute_region_security_policy.policyforinstance2.self_link"), @@ -3512,10 +3504,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance2.self_link", "google_compute_region_security_policy.policyforinstance.self_link"), @@ -3527,10 +3518,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPolicies(suffix, policyName, policyName2, instanceName, "\"\"", "\"\""), @@ -3541,10 +3531,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -3570,10 +3559,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithAccessConfigUpdateAccess ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigsUpdateAccessConfig(suffix, policyName, instanceName), @@ -3584,10 +3572,9 @@ func testAccComputeInstance_nic_securityPolicyCreateWithAccessConfigUpdateAccess ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigsRemoveAccessConfig(suffix, policyName, instanceName), @@ -10054,10 +10041,9 @@ func TestAccComputeInstance_bootDisk_storagePoolSpecified(t *testing.T) { ), }, { - ResourceName: "google_compute_instance.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_instance.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb index e836fc83d2bb..aceaea4f6ade 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_disk_test.go.erb @@ -209,10 +209,9 @@ func TestAccComputeRegionDisk_cloneDisk(t *testing.T) { ), }, { - ResourceName: "google_compute_region_disk.regiondisk-clone", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_disk.regiondisk-clone", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -238,19 +237,17 @@ func TestAccComputeRegionDisk_featuresUpdated(t *testing.T) { ), }, { - ResourceName: "google_compute_region_disk.regiondisk", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_disk.regiondisk", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRegionDisk_featuresUpdated(diskName), }, { - ResourceName: "google_compute_region_disk.regiondisk", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_disk.regiondisk", + ImportState: true, + ImportStateVerify: true, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb index 62be8724cf2c..7674b32c2d3e 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.erb @@ -761,10 +761,9 @@ func TestAccComputeRegionInstanceTemplate_enableDisplay(t *testing.T) { Config: testAccComputeRegionInstanceTemplate_enableDisplay(acctest.RandString(t, 10)), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -839,7 +838,7 @@ func TestAccComputeRegionInstanceTemplate_withScratchDisk(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name_prefix"}, }, }, }) @@ -859,7 +858,7 @@ func TestAccComputeRegionInstanceTemplate_with18TbScratchDisk(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name_prefix"}, }, }, }) @@ -886,7 +885,7 @@ func TestAccComputeRegionInstanceTemplate_imageResourceTest(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name_prefix"}, }, { Config: testAccComputeRegionInstanceTemplate_imageResourceTest(diskName, computeImage, imageDesc2), @@ -895,7 +894,7 @@ func TestAccComputeRegionInstanceTemplate_imageResourceTest(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"name_prefix"}, }, }, }) @@ -1027,10 +1026,9 @@ func TestAccComputeRegionInstanceTemplate_spot(t *testing.T) { ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1063,10 +1061,9 @@ func TestAccComputeRegionInstanceTemplate_spot_maxRunDuration(t *testing.T) { ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1097,10 +1094,9 @@ func TestAccComputeRegionInstanceTemplate_maxRunDuration_onInstanceStopAction(t ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1129,10 +1125,9 @@ func TestAccComputeRegionInstanceTemplate_localSsdRecoveryTimeout(t *testing.T) ), }, { - ResourceName: "google_compute_region_instance_template.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"terraform_labels"}, + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1166,7 +1161,7 @@ func TestAccComputeRegionalInstanceTemplate_partnerMetadata(t *testing.T) { ResourceName: "google_compute_region_instance_template.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace), "terraform_labels"}, + ImportStateVerifyIgnore: []string{fmt.Sprintf("partner_metadata.%s", namespace)}, }, }, }) @@ -1203,7 +1198,7 @@ func TestAccComputeRegionInstanceTemplate_sourceSnapshotEncryptionKey(t *testing ResourceName: "google_compute_region_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"disk.0.source_snapshot", "disk.0.source_snapshot_encryption_key"}, }, }, }) @@ -1237,7 +1232,7 @@ func TestAccComputeRegionInstanceTemplate_sourceImageEncryptionKey(t *testing.T) ResourceName: "google_compute_region_instance_template.template", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"disk.0.source_image_encryption_key"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go index 6997f65f9a19..5d9c79c1c50a 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_snapshot_test.go @@ -26,7 +26,7 @@ func TestAccComputeSnapshot_encryption(t *testing.T) { ResourceName: "google_compute_snapshot.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"snapshot_encryption_key", "source_disk", "source_disk_encryption_key", "zone", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"snapshot_encryption_key", "source_disk", "source_disk_encryption_key", "zone"}, }, }, }) @@ -52,7 +52,7 @@ func TestAccComputeSnapshot_encryptionCMEK(t *testing.T) { ResourceName: "google_compute_snapshot.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zone", "snapshot_encryption_key", "source_disk_encryption_key", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"zone", "snapshot_encryption_key", "source_disk_encryption_key"}, }, }, }) From f3d2e34f592899bfb8502ba033e1900d5d93b671 Mon Sep 17 00:00:00 2001 From: Cameron Thornton Date: Mon, 19 Aug 2024 05:14:07 -0500 Subject: [PATCH 4/7] address test failures --- mmv1/products/cloudrunv2/Service.yaml | 4 ++++ mmv1/products/compute/NetworkPeeringRoutesConfig.yaml | 2 ++ mmv1/products/edgecontainer/Cluster.yaml | 4 ++++ mmv1/products/kms/AutokeyConfig.yaml | 2 ++ mmv1/products/kms/KeyHandle.yaml | 2 ++ mmv1/products/networksecurity/ClientTlsPolicy.yaml | 4 ++++ mmv1/products/vertexai/FeatureOnlineStore.yaml | 2 ++ mmv1/products/vertexai/FeatureOnlineStoreFeatureview.yaml | 2 ++ mmv1/third_party/terraform/acctest/test_utils.go.erb | 5 +---- .../data_source_artifact_registry_docker_image_test.go | 1 + .../services/bigquery/resource_bigquery_dataset_test.go | 6 +++++- .../resource_bigquery_data_transfer_config_test.go | 3 ++- .../cloudrun/resource_cloud_run_service_test.go.erb | 1 + .../cloudrunv2/resource_cloud_run_v2_job_test.go.erb | 2 ++ .../cloudrunv2/resource_cloud_run_v2_service_test.go.erb | 1 + .../composer/resource_composer_environment_test.go.erb | 1 + .../container/resource_container_cluster_test.go.erb | 1 + .../container/resource_container_node_pool_test.go.erb | 1 + .../resource_network_security_client_tls_policy_test.go.erb | 1 + .../resource_network_services_lb_route_extension_test.go | 1 + .../resourcemanager/resource_google_project_test.go | 4 ++++ .../vertexai/resource_vertex_ai_index_endpoint_test.go | 1 + 22 files changed, 45 insertions(+), 6 deletions(-) diff --git a/mmv1/products/cloudrunv2/Service.yaml b/mmv1/products/cloudrunv2/Service.yaml index 8b43ef465556..6d4984d99815 100644 --- a/mmv1/products/cloudrunv2/Service.yaml +++ b/mmv1/products/cloudrunv2/Service.yaml @@ -141,6 +141,8 @@ examples: - 'deletion_protection' - !ruby/object:Provider::Terraform::Examples name: 'cloudrunv2_service_mount_gcs' + # Currently failing + skip_vcr: true primary_resource_id: 'default' primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-service-%s\", context[\"random_suffix\"])" vars: @@ -149,6 +151,8 @@ examples: - 'deletion_protection' - !ruby/object:Provider::Terraform::Examples name: 'cloudrunv2_service_mount_nfs' + # Currently failing + skip_vcr: true primary_resource_id: 'default' primary_resource_name: "fmt.Sprintf(\"tf-test-cloudrun-service-%s\", context[\"random_suffix\"])" vars: diff --git a/mmv1/products/compute/NetworkPeeringRoutesConfig.yaml b/mmv1/products/compute/NetworkPeeringRoutesConfig.yaml index af7abcb88ef1..8d63e5adbe86 100644 --- a/mmv1/products/compute/NetworkPeeringRoutesConfig.yaml +++ b/mmv1/products/compute/NetworkPeeringRoutesConfig.yaml @@ -69,6 +69,8 @@ examples: network_secondary_name: 'secondary-network' - !ruby/object:Provider::Terraform::Examples name: 'network_peering_routes_config_gke' + # currently failing + skip_vcr: true primary_resource_id: 'peering_gke_routes' vars: network_name: 'container-network' diff --git a/mmv1/products/edgecontainer/Cluster.yaml b/mmv1/products/edgecontainer/Cluster.yaml index 6c83007c351e..52ef2519de28 100644 --- a/mmv1/products/edgecontainer/Cluster.yaml +++ b/mmv1/products/edgecontainer/Cluster.yaml @@ -66,11 +66,15 @@ import_format: ["projects/{{project}}/locations/{{location}}/clusters/{{name}}"] examples: - !ruby/object:Provider::Terraform::Examples name: "edgecontainer_cluster" + # Currently failing + skip_vcr: true primary_resource_id: "default" vars: edgecontainer_cluster_name: "basic-cluster" - !ruby/object:Provider::Terraform::Examples name: "edgecontainer_cluster_with_maintenance_window" + # Currently failing + skip_vcr: true primary_resource_id: "default" vars: edgecontainer_cluster_name: "cluster-with-maintenance" diff --git a/mmv1/products/kms/AutokeyConfig.yaml b/mmv1/products/kms/AutokeyConfig.yaml index 845f3bf0521a..85e2e405cfa5 100644 --- a/mmv1/products/kms/AutokeyConfig.yaml +++ b/mmv1/products/kms/AutokeyConfig.yaml @@ -45,6 +45,8 @@ examples: - !ruby/object:Provider::Terraform::Examples name: 'kms_autokey_config_all' # Need the time_sleep resource + # Currently failing + skip_vcr: true external_providers: ["random", "time"] primary_resource_id: 'example-autokeyconfig' diff --git a/mmv1/products/kms/KeyHandle.yaml b/mmv1/products/kms/KeyHandle.yaml index 81e892c6c415..96cb6815b0c4 100644 --- a/mmv1/products/kms/KeyHandle.yaml +++ b/mmv1/products/kms/KeyHandle.yaml @@ -37,6 +37,8 @@ examples: - !ruby/object:Provider::Terraform::Examples name: 'kms_key_handle_basic' # Need the time_sleep resource + # Currently failing + skip_vcr: true external_providers: ["random", "time"] primary_resource_id: 'example-keyhandle' diff --git a/mmv1/products/networksecurity/ClientTlsPolicy.yaml b/mmv1/products/networksecurity/ClientTlsPolicy.yaml index 0f87404c7b78..a53881cc29a1 100644 --- a/mmv1/products/networksecurity/ClientTlsPolicy.yaml +++ b/mmv1/products/networksecurity/ClientTlsPolicy.yaml @@ -51,12 +51,16 @@ examples: - !ruby/object:Provider::Terraform::Examples min_version: beta name: 'network_security_client_tls_policy_basic' + # Currently failing + skip_vcr: true primary_resource_id: 'default' vars: resource_name: 'my-client-tls-policy' - !ruby/object:Provider::Terraform::Examples min_version: beta name: 'network_security_client_tls_policy_advanced' + # Currently failing + skip_vcr: true primary_resource_id: 'default' vars: resource_name: 'my-client-tls-policy' diff --git a/mmv1/products/vertexai/FeatureOnlineStore.yaml b/mmv1/products/vertexai/FeatureOnlineStore.yaml index 663299718ce9..748bb1237482 100644 --- a/mmv1/products/vertexai/FeatureOnlineStore.yaml +++ b/mmv1/products/vertexai/FeatureOnlineStore.yaml @@ -58,6 +58,8 @@ examples: - force_destroy - !ruby/object:Provider::Terraform::Examples name: vertex_ai_featureonlinestore_with_beta_fields_bigtable + # currently failing + skip_vcr: true primary_resource_id: featureonlinestore vars: name: example_feature_online_store_beta_bigtable diff --git a/mmv1/products/vertexai/FeatureOnlineStoreFeatureview.yaml b/mmv1/products/vertexai/FeatureOnlineStoreFeatureview.yaml index cd9503c51069..92521412723c 100644 --- a/mmv1/products/vertexai/FeatureOnlineStoreFeatureview.yaml +++ b/mmv1/products/vertexai/FeatureOnlineStoreFeatureview.yaml @@ -73,6 +73,8 @@ examples: name: 'example_cross_project_featureview' - !ruby/object:Provider::Terraform::Examples name: 'vertex_ai_featureonlinestore_featureview_with_vector_search' + # currently failing + skip_vcr: true primary_resource_id: 'featureview_vector_search' vars: name: 'example_feature_view_vector_search' diff --git a/mmv1/third_party/terraform/acctest/test_utils.go.erb b/mmv1/third_party/terraform/acctest/test_utils.go.erb index ae0ecaaf40e0..998a82f5bb1b 100644 --- a/mmv1/third_party/terraform/acctest/test_utils.go.erb +++ b/mmv1/third_party/terraform/acctest/test_utils.go.erb @@ -50,10 +50,7 @@ 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.") { + if strings.HasPrefix(k, "labels.") || strings.HasPrefix(k, "terraform_labels.") || strings.HasPrefix(k, "effective_labels.") { continue } if k == "%" { diff --git a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go index b71e1c66428e..7e080cda3cae 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go +++ b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go @@ -11,6 +11,7 @@ import ( ) func TestAccDataSourceArtifactRegistryDockerImage(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() resourceName := "data.google_artifact_registry_docker_image.test" diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go index 52c52f5eab07..876291d15ef3 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go @@ -123,7 +123,7 @@ func TestAccBigQueryDataset_withComputedLabels(t *testing.T) { resource.TestCheckResourceAttr("google_bigquery_dataset.test", "labels.env", "foo"), resource.TestCheckResourceAttr("google_bigquery_dataset.test", "labels.default_table_expiration_ms", "3600000"), - resource.TestCheckResourceAttr("google_bigquery_dataset.test", "effective_labels.%", "2"), + resource.TestCheckResourceAttr("google_bigquery_dataset.test", "effective_labels.%", "3"), resource.TestCheckResourceAttr("google_bigquery_dataset.test", "effective_labels.env", "foo"), resource.TestCheckResourceAttr("google_bigquery_dataset.test", "effective_labels.default_table_expiration_ms", "3600000"), ), @@ -494,6 +494,10 @@ func addOutOfBandLabels(t *testing.T, datasetID string) resource.TestCheckFunc { func testAccBigQueryDataset_withoutLabels(datasetID string) string { return fmt.Sprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_bigquery_dataset" "test" { dataset_id = "%s" friendly_name = "foo" diff --git a/mmv1/third_party/terraform/services/bigquerydatatransfer/resource_bigquery_data_transfer_config_test.go b/mmv1/third_party/terraform/services/bigquerydatatransfer/resource_bigquery_data_transfer_config_test.go index 15a9bd011016..b2b0487466d6 100644 --- a/mmv1/third_party/terraform/services/bigquerydatatransfer/resource_bigquery_data_transfer_config_test.go +++ b/mmv1/third_party/terraform/services/bigquerydatatransfer/resource_bigquery_data_transfer_config_test.go @@ -301,7 +301,8 @@ func TestAccBigqueryDataTransferConfig(t *testing.T) { "booleanParam": testAccBigqueryDataTransferConfig_copy_booleanParam, "update_params": testAccBigqueryDataTransferConfig_force_new_update_params, "update_service_account": testAccBigqueryDataTransferConfig_scheduledQuery_update_service_account, - "salesforce": testAccBigqueryDataTransferConfig_salesforce_basic, + // Multiple connector.authentication.* fields have been deprecated and return 400 errors + // "salesforce": testAccBigqueryDataTransferConfig_salesforce_basic, } for name, tc := range testCases { diff --git a/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb b/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb index 23e874c2d65b..a94d36b1b336 100644 --- a/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb @@ -1316,6 +1316,7 @@ resource "google_cloud_run_service" "default" { <% unless version == 'ga' -%> func TestAccCloudRunService_csiVolume(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() project := envvar.GetTestProjectFromEnv() diff --git a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_job_test.go.erb b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_job_test.go.erb index 509fc053301a..114ed5e58652 100644 --- a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_job_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_job_test.go.erb @@ -311,6 +311,7 @@ func testAccCloudRunV2Job_cloudrunv2JobWithDirectVPCAndNamedBinAuthPolicyUpdate( <% unless version == 'ga' -%> func TestAccCloudRunV2Job_cloudrunv2JobWithGcsUpdate(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() jobName := fmt.Sprintf("tf-test-cloudrun-service%s", acctest.RandString(t, 10)) @@ -399,6 +400,7 @@ func testAccCloudRunV2Job_cloudrunv2JobWithGcsVolume(context map[string]interfac } func TestAccCloudRunV2Job_cloudrunv2JobWithNfsUpdate(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() jobName := fmt.Sprintf("tf-test-cloudrun-service%s", acctest.RandString(t, 10)) diff --git a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb index e9f3adf860d5..9d2a77a252f0 100644 --- a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.erb @@ -212,6 +212,7 @@ resource "google_compute_network" "custom_test" { } <% unless version == 'ga' -%> func TestAccCloudRunV2Service_cloudrunv2ServiceGcsVolume(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() context := map[string]interface{}{ diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.erb b/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.erb index 576cded24877..fbc634a70813 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.erb +++ b/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.erb @@ -354,6 +354,7 @@ func TestAccComposerEnvironment_withEncryptionConfigComposer1(t *testing.T) { } func TestAccComposerEnvironment_withEncryptionConfigComposer2(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb index 08ee69a7fa11..4c094b917a81 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb @@ -10798,6 +10798,7 @@ resource "google_container_cluster" "with_autopilot" { } func TestAccContainerCluster_privateRegistry(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb index 5b56bea95dc3..7242a9e59da7 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb @@ -4874,6 +4874,7 @@ resource "google_container_node_pool" "np" { } func TestAccContainerNodePool_defaultDriverInstallation(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) diff --git a/mmv1/third_party/terraform/services/networksecurity/resource_network_security_client_tls_policy_test.go.erb b/mmv1/third_party/terraform/services/networksecurity/resource_network_security_client_tls_policy_test.go.erb index 3d2c080bc1c2..cf3799f5460a 100644 --- a/mmv1/third_party/terraform/services/networksecurity/resource_network_security_client_tls_policy_test.go.erb +++ b/mmv1/third_party/terraform/services/networksecurity/resource_network_security_client_tls_policy_test.go.erb @@ -11,6 +11,7 @@ import ( ) func TestAccNetworkSecurityClientTlsPolicy_update(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() clientTlsPolicyName := fmt.Sprintf("tf-test-client-tls-policy-%s", acctest.RandString(t, 10)) diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_lb_route_extension_test.go b/mmv1/third_party/terraform/services/networkservices/resource_network_services_lb_route_extension_test.go index 93ccc3a9017b..cd021c187255 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_lb_route_extension_test.go +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_lb_route_extension_test.go @@ -8,6 +8,7 @@ import ( ) func TestAccNetworkServicesLbRouteExtension_update(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() context := map[string]interface{}{ diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_test.go b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_test.go index 2bdac97b9dfc..e32f0db67e2c 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_test.go +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_test.go @@ -467,6 +467,10 @@ resource "google_project" "acceptance" { func testAccProject_labels(pid, org string, labels map[string]string) string { r := fmt.Sprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_project" "acceptance" { project_id = "%s" name = "%s" diff --git a/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_endpoint_test.go b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_endpoint_test.go index 358e5c66a0ef..88c514efc684 100644 --- a/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_endpoint_test.go +++ b/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_endpoint_test.go @@ -9,6 +9,7 @@ import ( ) func TestAccVertexAIIndexEndpoint_updated(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() context := map[string]interface{}{ From 7c2a11283bb0418381ef24fad8c53f35b5aed69e Mon Sep 17 00:00:00 2001 From: Cameron Thornton Date: Mon, 19 Aug 2024 12:20:09 -0500 Subject: [PATCH 5/7] add SetLabelsDiffWithoutAttributionLabel --- mmv1/api/resource.rb | 10 +++++++++- mmv1/products/compute/ForwardingRule.yaml | 2 ++ mmv1/products/compute/GlobalForwardingRule.yaml | 2 ++ mmv1/products/dataplex/Datascan.yaml | 2 ++ mmv1/products/dataplex/Task.yaml | 2 ++ .../services/dataproc/resource_dataproc_cluster.go | 3 ++- .../data_source_secret_manager_secrets_test.go | 14 ++++++++++---- mmv1/third_party/terraform/tpgresource/labels.go | 11 +++++++++++ 8 files changed, 40 insertions(+), 6 deletions(-) diff --git a/mmv1/api/resource.rb b/mmv1/api/resource.rb index 98d2b0fe775a..9cbc3215db20 100644 --- a/mmv1/api/resource.rb +++ b/mmv1/api/resource.rb @@ -250,6 +250,9 @@ module Properties # Add a deprecation message for a resource that's been deprecated in the API. attr_reader :deprecation_message + + # Do not apply the default attribution label + attr_reader :skip_attribution_label end include Properties @@ -342,6 +345,7 @@ def validate check :taint_resource_on_failed_create, type: :boolean, default: false check :skip_sweeper, type: :boolean, default: false check :deprecation_message, type: ::String + check :skip_attribution_label, type: :boolean, default: false validate_identity unless @identity.nil? end @@ -475,7 +479,11 @@ def add_labels_related_fields(props, parent) def add_labels_fields(props, parent, labels) @custom_diff ||= [] if parent.nil? || parent.flatten_object - @custom_diff.append('tpgresource.SetLabelsDiff') + if @skip_attribution_label + @custom_diff.append('tpgresource.SetLabelsDiffWithoutAttributionLabel') + else + @custom_diff.append('tpgresource.SetLabelsDiff') + end elsif parent.name == 'metadata' @custom_diff.append('tpgresource.SetMetadataLabelsDiff') end diff --git a/mmv1/products/compute/ForwardingRule.yaml b/mmv1/products/compute/ForwardingRule.yaml index d87d91b3c6aa..e58ef0eb4559 100644 --- a/mmv1/products/compute/ForwardingRule.yaml +++ b/mmv1/products/compute/ForwardingRule.yaml @@ -17,6 +17,8 @@ kind: 'compute#forwardingRule' base_url: projects/{{project}}/regions/{{region}}/forwardingRules collection_url_key: 'items' has_self_link: true +# Has a separate endpoint for labels +skip_attribution_label: true description: | A ForwardingRule resource. A ForwardingRule resource specifies which pool of target virtual machines to forward a packet to if it matches the given diff --git a/mmv1/products/compute/GlobalForwardingRule.yaml b/mmv1/products/compute/GlobalForwardingRule.yaml index 439777281782..d39c85bf8da5 100644 --- a/mmv1/products/compute/GlobalForwardingRule.yaml +++ b/mmv1/products/compute/GlobalForwardingRule.yaml @@ -17,6 +17,8 @@ kind: 'compute#forwardingRule' base_url: projects/{{project}}/global/forwardingRules immutable: true has_self_link: true +# Has a separate endpoint for labels +skip_attribution_label: true legacy_long_form_project: true collection_url_key: 'items' description: | diff --git a/mmv1/products/dataplex/Datascan.yaml b/mmv1/products/dataplex/Datascan.yaml index c1c71bed0dc2..eb70d4b116e4 100644 --- a/mmv1/products/dataplex/Datascan.yaml +++ b/mmv1/products/dataplex/Datascan.yaml @@ -18,6 +18,8 @@ self_link: 'projects/{{project}}/locations/{{location}}/dataScans/{{data_scan_id create_url: 'projects/{{project}}/locations/{{location}}/dataScans?dataScanId={{data_scan_id}}' update_verb: :PATCH update_mask: true +# User-provided label cannot start with goog- +skip_attribution_label: true import_format: [ 'projects/{{project}}/locations/{{location}}/dataScans/{{data_scan_id}}', diff --git a/mmv1/products/dataplex/Task.yaml b/mmv1/products/dataplex/Task.yaml index 66ed12c16dbb..ecd20a1b7be5 100644 --- a/mmv1/products/dataplex/Task.yaml +++ b/mmv1/products/dataplex/Task.yaml @@ -19,6 +19,8 @@ update_url: 'projects/{{project}}/locations/{{location}}/lakes/{{lake}}/tasks/{{ delete_url: 'projects/{{project}}/locations/{{location}}/lakes/{{lake}}/tasks/{{task_id}}' update_verb: :PATCH update_mask: true +# User-provided label cannot start with goog- +skip_attribution_label: true description: | A Dataplex task represents the work that you want Dataplex to do on a schedule. It encapsulates code, parameters, and the schedule. async: !ruby/object:Api::OpAsync diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go index 0abed2ab6332..8535f48d4833 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go @@ -187,7 +187,8 @@ func ResourceDataprocCluster() *schema.Resource { CustomizeDiff: customdiff.All( tpgresource.DefaultProviderProject, - tpgresource.SetLabelsDiff, + // User labels are not supported in Dataproc Virtual Cluster + tpgresource.SetLabelsDiffWithoutAttributionLabel, ), SchemaVersion: 1, diff --git a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go index 792e9bb41875..804c1539ad8c 100644 --- a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go +++ b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go @@ -30,8 +30,11 @@ func TestAccDataSourceSecretManagerSecrets_basic(t *testing.T) { "data.google_secret_manager_secrets.foo", "google_secret_manager_secret.foo", map[string]struct{}{ - "id": {}, - "project": {}, + "id": {}, + "project": {}, + "effective_labels": {}, + "labels": {}, + "terraform_labels": {}, }, ), ), @@ -82,8 +85,11 @@ func TestAccDataSourceSecretManagerSecrets_filter(t *testing.T) { "google_secret_manager_secret.foo", "google_secret_manager_secret.bar", map[string]struct{}{ - "id": {}, - "project": {}, + "id": {}, + "project": {}, + "effective_labels": {}, + "labels": {}, + "terraform_labels": {}, }, ), ), diff --git a/mmv1/third_party/terraform/tpgresource/labels.go b/mmv1/third_party/terraform/tpgresource/labels.go index 255be2b6e061..67c9593520e8 100644 --- a/mmv1/third_party/terraform/tpgresource/labels.go +++ b/mmv1/third_party/terraform/tpgresource/labels.go @@ -132,6 +132,17 @@ func setLabelsFields(labelsField string, d *schema.ResourceDiff, meta interface{ return nil } +func SetLabelsDiffWithoutAttributionLabel(c context.Context, d *schema.ResourceDiff, meta interface{}) error { + config := meta.(*transport_tpg.Config) + previouslySetValue := config.AddTerraformAttributionLabel + config.AddTerraformAttributionLabel = false + + err := SetLabelsDiff(c, d, meta) + + config.AddTerraformAttributionLabel = previouslySetValue + return err +} + // The CustomizeDiff func to set the values of terraform_labels and effective_labels fields // when labels field is at the root level and named "labels". func SetLabelsDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { From 97bae40c0d48d459984e8344c5d792f8acefedb7 Mon Sep 17 00:00:00 2001 From: Cameron Thornton Date: Mon, 19 Aug 2024 17:25:06 -0500 Subject: [PATCH 6/7] few more tests --- .../data_source_google_container_cluster_test.go | 1 + .../data_source_secret_manager_secrets_test.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go b/mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go index 07ea739fd057..1a11eebfd502 100644 --- a/mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go +++ b/mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go @@ -60,6 +60,7 @@ func TestAccContainerClusterDatasource_regional(t *testing.T) { "enable_tpu": {}, "pod_security_policy_config.#": {}, "deletion_protection": {}, + "resource_labels": {}, }, ), ), diff --git a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go index 804c1539ad8c..afe3300036eb 100644 --- a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go +++ b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go @@ -45,6 +45,10 @@ func TestAccDataSourceSecretManagerSecrets_basic(t *testing.T) { func testAccDataSourceSecretManagerSecrets_basic(context map[string]interface{}) string { return acctest.Nprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_secret_manager_secret" "foo" { secret_id = "tf-test-secret-%{random_suffix}" @@ -100,6 +104,10 @@ func TestAccDataSourceSecretManagerSecrets_filter(t *testing.T) { func testAccDataSourceSecretManagerSecrets_filter(context map[string]interface{}) string { return acctest.Nprintf(` +provider "google" { + add_terraform_attribution_label = false +} + resource "google_secret_manager_secret" "foo" { secret_id = "tf-test-secret-%{random_suffix}" From 6b97ec1c74182163d250feddde7f8499af23af01 Mon Sep 17 00:00:00 2001 From: Cameron Thornton Date: Tue, 20 Aug 2024 08:18:14 -0500 Subject: [PATCH 7/7] Fix TestAccComputeVpnGateway_targetVpnGatewayBasicExample --- .../terraform/tpgresource/labels.go | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/mmv1/third_party/terraform/tpgresource/labels.go b/mmv1/third_party/terraform/tpgresource/labels.go index 67c9593520e8..7db1a6305e66 100644 --- a/mmv1/third_party/terraform/tpgresource/labels.go +++ b/mmv1/third_party/terraform/tpgresource/labels.go @@ -56,7 +56,7 @@ func SetDataSourceLabels(d *schema.ResourceData) error { } // Sets the values of terraform_labels and effective_labels fields when labels field is in root level -func setLabelsFields(labelsField string, d *schema.ResourceDiff, meta interface{}) error { +func setLabelsFields(labelsField string, d *schema.ResourceDiff, meta interface{}, skipAttribution bool) error { raw := d.Get(labelsField) if raw == nil { return nil @@ -92,7 +92,7 @@ func setLabelsFields(labelsField string, d *schema.ResourceDiff, meta interface{ } // Append optional label indicating the resource was provisioned using Terraform - if config.AddTerraformAttributionLabel { + if !skipAttribution && config.AddTerraformAttributionLabel { if el, ok := d.Get("effective_labels").(map[string]any); ok { _, hasExistingLabel := el[transport_tpg.AttributionKey] if hasExistingLabel || @@ -132,28 +132,21 @@ func setLabelsFields(labelsField string, d *schema.ResourceDiff, meta interface{ return nil } -func SetLabelsDiffWithoutAttributionLabel(c context.Context, d *schema.ResourceDiff, meta interface{}) error { - config := meta.(*transport_tpg.Config) - previouslySetValue := config.AddTerraformAttributionLabel - config.AddTerraformAttributionLabel = false - - err := SetLabelsDiff(c, d, meta) - - config.AddTerraformAttributionLabel = previouslySetValue - return err +func SetLabelsDiffWithoutAttributionLabel(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { + return setLabelsFields("labels", d, meta, true) } // The CustomizeDiff func to set the values of terraform_labels and effective_labels fields // when labels field is at the root level and named "labels". func SetLabelsDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { - return setLabelsFields("labels", d, meta) + return setLabelsFields("labels", d, meta, false) } // The CustomizeDiff func to set the values of terraform_labels and effective_labels fields // when labels field is at the root level and has a diffent name (e.g. resource_labels) than "labels" func SetDiffForLabelsWithCustomizedName(labelsField string) func(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { return func(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { - return setLabelsFields(labelsField, d, meta) + return setLabelsFields(labelsField, d, meta, false) } }