Skip to content

Commit

Permalink
Fixed TestAccNetworkServicesGateway_update (#12749)
Browse files Browse the repository at this point in the history
  • Loading branch information
melinath authored Jan 14, 2025
1 parent c389029 commit c5cd538
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
3 changes: 1 addition & 2 deletions mmv1/products/networkservices/Gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async:
custom_code:
constants: 'templates/terraform/constants/network_services_gateway.go.tmpl'
post_delete: 'templates/terraform/post_delete/network_services_gateway.go.tmpl'
pre_update: 'templates/terraform/pre_update/network_services_gateway.go.tmpl'
update_encoder: 'templates/terraform/update_encoder/network_services_gateway.go.tmpl'
examples:
- name: 'network_services_gateway_basic'
primary_resource_id: 'default'
Expand Down Expand Up @@ -147,7 +147,6 @@ properties:
The proxy binds to the specified ports. Gateways of type 'SECURE_WEB_GATEWAY' are
limited to 1 port. Gateways of type 'OPEN_MESH' listen on 0.0.0.0 and support multiple ports.
required: true
immutable: true
item_type:
type: Integer
- name: 'scope'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Always force-send some attributes even if they were not modified. This works around extra API-side requirements.
obj["scope"] = d.Get("scope")
if d.Get("type") == "SECURE_WEB_GATEWAY" {
obj["name"] = d.Get("name")
obj["type"] = d.Get("type")
obj["routingMode"] = d.Get("routingMode")
}
return obj, nil
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/acctest"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/plancheck"
)

func TestAccNetworkServicesGateway_update(t *testing.T) {
Expand All @@ -30,6 +31,11 @@ func TestAccNetworkServicesGateway_update(t *testing.T) {
},
{
Config: testAccNetworkServicesGateway_update(gatewayName),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_network_services_gateway.foobar", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_network_services_gateway.foobar",
Expand Down Expand Up @@ -59,7 +65,7 @@ resource "google_network_services_gateway" "foobar" {
name = "%s"
scope = "default-scope-update"
type = "OPEN_MESH"
ports = [443]
ports = [1000]
description = "update description"
labels = {
foo = "bar"
Expand Down

0 comments on commit c5cd538

Please sign in to comment.