From 100478d0a61ca9e0891cd2908d43f7f97308dfaf Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 27 Jan 2025 15:19:12 +0530 Subject: [PATCH 01/15] Add labels property to HA VPN Gateway --- mmv1/products/compute/HaVpnGateway.yaml | 18 ++++++++++++++++++ .../examples/ha_vpn_gateway_basic.tf.tmpl | 3 +++ .../examples/ha_vpn_gateway_ipv6.tf.tmpl | 3 +++ 3 files changed, 24 insertions(+) diff --git a/mmv1/products/compute/HaVpnGateway.yaml b/mmv1/products/compute/HaVpnGateway.yaml index 34e01079df17..7bbff38057a9 100644 --- a/mmv1/products/compute/HaVpnGateway.yaml +++ b/mmv1/products/compute/HaVpnGateway.yaml @@ -169,3 +169,21 @@ properties: custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl' resource: 'InterconnectAttachment' imports: 'selfLink' + - name: 'labels' + type: KeyValueLabels + update_url: 'projects/{{project}}/global/haVpnGateways/{{name}}/setLabels' + update_verb: 'POST' + description: | + Labels for this resource. These can only be added or modified by the setLabels method. + Each label key/value pair must comply with RFC1035. Label values may be empty. + - name: 'labelFingerprint' + type: Fingerprint + update_url: 'projects/{{project}}/global/haVpnGateways/{{name}}/setLabels' + update_verb: 'POST' + description: | + A fingerprint for the labels being applied to this VpnGateway, which is essentially a hash + of the labels set used for optimistic locking. The fingerprint is initially generated by + Compute Engine and changes after every request to modify or update labels. + You must always provide an up-to-date fingerprint hash in order to update or change labels, + otherwise the request will fail with error 412 conditionNotMet. + output: true diff --git a/mmv1/templates/terraform/examples/ha_vpn_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/ha_vpn_gateway_basic.tf.tmpl index a20645e5e9da..d67f82616176 100644 --- a/mmv1/templates/terraform/examples/ha_vpn_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/ha_vpn_gateway_basic.tf.tmpl @@ -2,6 +2,9 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway1" { region = "us-central1" name = "{{index $.Vars "ha_vpn_gateway1_name"}}" network = google_compute_network.network1.id + labels = { + mykey = "myvalue" + } } resource "google_compute_network" "network1" { diff --git a/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl index 7c5efe0534d6..62ae72ec7fda 100644 --- a/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl +++ b/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl @@ -3,6 +3,9 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway1" { name = "{{index $.Vars "ha_vpn_gateway1_name"}}" network = google_compute_network.network1.id stack_type = "IPV4_IPV6" + labels = { + mykey = "myvalue" + } } resource "google_compute_network" "network1" { From 9568c18c40108329dced363905285cbd78a9dfd0 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 27 Jan 2025 15:27:48 +0530 Subject: [PATCH 02/15] Fix Lint --- mmv1/products/compute/HaVpnGateway.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/compute/HaVpnGateway.yaml b/mmv1/products/compute/HaVpnGateway.yaml index 7bbff38057a9..e339ea2dbd11 100644 --- a/mmv1/products/compute/HaVpnGateway.yaml +++ b/mmv1/products/compute/HaVpnGateway.yaml @@ -174,7 +174,7 @@ properties: update_url: 'projects/{{project}}/global/haVpnGateways/{{name}}/setLabels' update_verb: 'POST' description: | - Labels for this resource. These can only be added or modified by the setLabels method. + Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. - name: 'labelFingerprint' type: Fingerprint From e09c169ecc0207f82052abd788e857755c741002 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 27 Jan 2025 15:56:23 +0530 Subject: [PATCH 03/15] Fix update url --- mmv1/products/compute/HaVpnGateway.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/products/compute/HaVpnGateway.yaml b/mmv1/products/compute/HaVpnGateway.yaml index e339ea2dbd11..a3b9e5f65f75 100644 --- a/mmv1/products/compute/HaVpnGateway.yaml +++ b/mmv1/products/compute/HaVpnGateway.yaml @@ -171,14 +171,14 @@ properties: imports: 'selfLink' - name: 'labels' type: KeyValueLabels - update_url: 'projects/{{project}}/global/haVpnGateways/{{name}}/setLabels' + update_url: 'projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}/setLabels' update_verb: 'POST' description: | Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. - name: 'labelFingerprint' type: Fingerprint - update_url: 'projects/{{project}}/global/haVpnGateways/{{name}}/setLabels' + update_url: 'projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}/setLabels' update_verb: 'POST' description: | A fingerprint for the labels being applied to this VpnGateway, which is essentially a hash From 69827dec05ad17223197e01d5fbf67475fe28a36 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Thu, 30 Jan 2025 04:42:40 +0000 Subject: [PATCH 04/15] Add update test --- ...urce_compute_ha_vpn_gateway_labels_test.go | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go new file mode 100644 index 000000000000..d99d6596cf17 --- /dev/null +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go @@ -0,0 +1,64 @@ +package compute_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-provider-google/google/acctest" +) + +func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { + t.Parallel() + + rnd := acctest.RandString(t, 10) + resourceName := "google_compute_ha_vpn_gateway.ha_gateway1" + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test", "test"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), + resource.TestCheckResourceAttr(resourceName, "labels.test", "test"), + ), + }, + { + ResourceName: resourceName + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "network", "region", "terraform_labels"}, + }, + { + Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test-updated", "test-updated"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), + resource.TestCheckResourceAttr(resourceName, "labels.test-updated", "test-updated"), + ), + }, + { + ResourceName: resourceName + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "network", "region", "terraform_labels"}, + }, + }, + }) +} + +func testAccComputeHaVpnGateway_updateLabels(suffix, key, value string) string { + return acctest.Nprintf(` +resource "google_compute_ha_vpn_gateway" "ha_gateway1" { + region = "us-central1" + name = "tf-test-ha-vpn-1%s" + network = google_compute_network.network1.id + labels = { + %s = "%s" + } +} +`, suffix, key, value) +} \ No newline at end of file From 74c4a4768e5e4811192f7021e2c85e9089eec22d Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Thu, 30 Jan 2025 04:51:07 +0000 Subject: [PATCH 05/15] Fix --- .../resource_compute_ha_vpn_gateway_labels_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go index d99d6596cf17..4d9343d03de4 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go @@ -1,12 +1,9 @@ package compute_test import ( - "fmt" - "strings" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-google/google/acctest" ) @@ -28,7 +25,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ), }, { - ResourceName: resourceName + ResourceName: resourceName, ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "network", "region", "terraform_labels"}, @@ -41,7 +38,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ), }, { - ResourceName: resourceName + ResourceName: resourceName, ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "network", "region", "terraform_labels"}, @@ -61,4 +58,4 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway1" { } } `, suffix, key, value) -} \ No newline at end of file +} From 484a8e78324ffa2f75b10a51665da753535e87a4 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Thu, 30 Jan 2025 05:00:32 +0000 Subject: [PATCH 06/15] Fix --- .../compute/resource_compute_ha_vpn_gateway_labels_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go index 4d9343d03de4..606046b90f27 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go @@ -1,6 +1,7 @@ package compute_test import ( + "fmt" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -48,7 +49,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { } func testAccComputeHaVpnGateway_updateLabels(suffix, key, value string) string { - return acctest.Nprintf(` + return fmt.Sprintf(` resource "google_compute_ha_vpn_gateway" "ha_gateway1" { region = "us-central1" name = "tf-test-ha-vpn-1%s" From 89dcc676b9d4a7353bf09e3791d42da438ecc24b Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 06:14:24 +0000 Subject: [PATCH 07/15] Review changes --- ...els_test.go => resource_compute_ha_vpn_gateway_test.go} | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) rename mmv1/third_party/terraform/services/compute/{resource_compute_ha_vpn_gateway_labels_test.go => resource_compute_ha_vpn_gateway_test.go} (92%) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go similarity index 92% rename from mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go rename to mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index 606046b90f27..f352dbcdc73a 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_labels_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -58,5 +58,10 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway1" { %s = "%s" } } -`, suffix, key, value) + +resource "google_compute_network" "network1" { + name = "network1%s" + auto_create_subnetworks = false +} +`, suffix, key, value, suffix) } From 87dd24e86fdc9e959f8d1ff382d84fe553898491 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 07:35:49 +0000 Subject: [PATCH 08/15] Fix --- .../resource_compute_ha_vpn_gateway_test.go | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index f352dbcdc73a..bbb68af0e434 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -19,7 +19,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test", "test"), + Config: testAccComputeHaVpnGateway_base(rnd), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), resource.TestCheckResourceAttr(resourceName, "labels.test", "test"), @@ -32,7 +32,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ImportStateVerifyIgnore: []string{"labels", "network", "region", "terraform_labels"}, }, { - Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test-updated", "test-updated"), + Config: testAccComputeHaVpnGateway_update(rnd), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), resource.TestCheckResourceAttr(resourceName, "labels.test-updated", "test-updated"), @@ -48,14 +48,14 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { }) } -func testAccComputeHaVpnGateway_updateLabels(suffix, key, value string) string { +func testAccComputeHaVpnGateway_base(suffix string) string { return fmt.Sprintf(` resource "google_compute_ha_vpn_gateway" "ha_gateway1" { region = "us-central1" name = "tf-test-ha-vpn-1%s" network = google_compute_network.network1.id labels = { - %s = "%s" + test = "test" } } @@ -63,5 +63,23 @@ resource "google_compute_network" "network1" { name = "network1%s" auto_create_subnetworks = false } -`, suffix, key, value, suffix) +`, suffix, suffix) +} + +func testAccComputeHaVpnGateway_update(suffix string) string { + return fmt.Sprintf(` +resource "google_compute_ha_vpn_gateway" "ha_gateway1" { + region = "us-central1" + name = "tf-test-ha-vpn-1%s" + network = google_compute_network.network1.id + labels = { + test-updated = "test-upadated" + } +} + +resource "google_compute_network" "network1" { + name = "network1%s" + auto_create_subnetworks = false +} +`, suffix, suffix) } From 72cb612463cfe0371b81ad65282b1361b620736b Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 08:23:12 +0000 Subject: [PATCH 09/15] Check --- .../resource_compute_ha_vpn_gateway_test.go | 33 +++++-------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index bbb68af0e434..3e795b318d9a 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -19,7 +19,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeHaVpnGateway_base(rnd), + Config: testAccComputeHaVpnGateway_updateLabels(rnd), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), resource.TestCheckResourceAttr(resourceName, "labels.test", "test"), @@ -29,51 +29,34 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "network", "region", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, { - Config: testAccComputeHaVpnGateway_update(rnd), + Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test", "test-updated"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), - resource.TestCheckResourceAttr(resourceName, "labels.test-updated", "test-updated"), + resource.TestCheckResourceAttr(resourceName, "labels.test", "test-updated"), ), }, { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "network", "region", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, }, }) } -func testAccComputeHaVpnGateway_base(suffix string) string { +func testAccComputeHaVpnGateway_updateLabels(suffix, key, value string) string { return fmt.Sprintf(` resource "google_compute_ha_vpn_gateway" "ha_gateway1" { region = "us-central1" name = "tf-test-ha-vpn-1%s" network = google_compute_network.network1.id - labels = { - test = "test" - } -} - -resource "google_compute_network" "network1" { - name = "network1%s" - auto_create_subnetworks = false -} -`, suffix, suffix) -} -func testAccComputeHaVpnGateway_update(suffix string) string { - return fmt.Sprintf(` -resource "google_compute_ha_vpn_gateway" "ha_gateway1" { - region = "us-central1" - name = "tf-test-ha-vpn-1%s" - network = google_compute_network.network1.id labels = { - test-updated = "test-upadated" + %s = "%s" } } @@ -81,5 +64,5 @@ resource "google_compute_network" "network1" { name = "network1%s" auto_create_subnetworks = false } -`, suffix, suffix) +`, suffix, key, value, suffix) } From aab2d84b94a273da9ff33d0c839ddc61b4522967 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 08:58:21 +0000 Subject: [PATCH 10/15] Fix --- .../compute/resource_compute_ha_vpn_gateway_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index 3e795b318d9a..ab264ff8649a 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -19,7 +19,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeHaVpnGateway_updateLabels(rnd), + Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test", "test"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), resource.TestCheckResourceAttr(resourceName, "labels.test", "test"), @@ -32,10 +32,10 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, { - Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test", "test-updated"), + Config: testAccComputeHaVpnGateway_updateLabels(rnd, "testUpdated", "testUpdated"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), - resource.TestCheckResourceAttr(resourceName, "labels.test", "test-updated"), + resource.TestCheckResourceAttr(resourceName, "labels.testUpdated", "testUpdated"), ), }, { From d5434e35003dfc60fe375f806c9c50fe17cf8d13 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 09:36:17 +0000 Subject: [PATCH 11/15] fix --- .../services/compute/resource_compute_ha_vpn_gateway_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index ab264ff8649a..93a2b282c06c 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -32,10 +32,10 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, }, { - Config: testAccComputeHaVpnGateway_updateLabels(rnd, "testUpdated", "testUpdated"), + Config: testAccComputeHaVpnGateway_updateLabels(rnd, "testupdated", "testupdated"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), - resource.TestCheckResourceAttr(resourceName, "labels.testUpdated", "testUpdated"), + resource.TestCheckResourceAttr(resourceName, "labels.testupdated", "testupdated"), ), }, { From f7d9b67e913de195ba2d4fed56b668dd8db40d4f Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 10:51:48 +0000 Subject: [PATCH 12/15] Add config plan check --- .../compute/resource_compute_ha_vpn_gateway_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index 93a2b282c06c..34ca4d5f386b 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -20,6 +20,11 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test", "test"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("google_pubsub_topic.foo", plancheck.ResourceActionUpdate), + }, + }, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), resource.TestCheckResourceAttr(resourceName, "labels.test", "test"), @@ -33,6 +38,11 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { }, { Config: testAccComputeHaVpnGateway_updateLabels(rnd, "testupdated", "testupdated"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("google_pubsub_topic.foo", plancheck.ResourceActionUpdate), + }, + }, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), resource.TestCheckResourceAttr(resourceName, "labels.testupdated", "testupdated"), From d09df3971601e8f4d526c3de541da575c2914973 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 11:30:42 +0000 Subject: [PATCH 13/15] PLan check --- .../compute/resource_compute_ha_vpn_gateway_test.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index 34ca4d5f386b..c3c2d7ed48db 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -20,11 +20,6 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccComputeHaVpnGateway_updateLabels(rnd, "test", "test"), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_pubsub_topic.foo", plancheck.ResourceActionUpdate), - }, - }, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), resource.TestCheckResourceAttr(resourceName, "labels.test", "test"), @@ -40,7 +35,7 @@ func TestAccComputeHaVpnGateway_updateLabels(t *testing.T) { Config: testAccComputeHaVpnGateway_updateLabels(rnd, "testupdated", "testupdated"), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_pubsub_topic.foo", plancheck.ResourceActionUpdate), + plancheck.ExpectResourceAction("google_compute_ha_vpn_gateway.ha_gateway1", plancheck.ResourceActionUpdate), }, }, Check: resource.ComposeTestCheckFunc( From 9076ade887b166e0b3fa5a2b28f177bb0124f24f Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Mon, 3 Feb 2025 11:59:50 +0000 Subject: [PATCH 14/15] Import --- .../services/compute/resource_compute_ha_vpn_gateway_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go index c3c2d7ed48db..241fceb5669b 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_ha_vpn_gateway_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-provider-google/google/acctest" ) From 0362b0383b8b719155d09e2f88305662b472b8c7 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Tue, 4 Feb 2025 06:16:57 +0000 Subject: [PATCH 15/15] Add custom code --- mmv1/products/compute/HaVpnGateway.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/compute/HaVpnGateway.yaml b/mmv1/products/compute/HaVpnGateway.yaml index a3b9e5f65f75..137666c0c47a 100644 --- a/mmv1/products/compute/HaVpnGateway.yaml +++ b/mmv1/products/compute/HaVpnGateway.yaml @@ -41,6 +41,7 @@ async: resource_inside_response: false collection_url_key: 'items' custom_code: + post_create: 'templates/terraform/post_create/labels.tmpl' schema_version: 1 state_upgraders: true examples: