Skip to content

Commit

Permalink
make enableProxyProtocol field updatable in service_attachment (Googl…
Browse files Browse the repository at this point in the history
  • Loading branch information
felipegc authored and joelkattapuram committed Sep 20, 2023
1 parent e737699 commit 5ca51f1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
1 change: 0 additions & 1 deletion mmv1/products/compute/ServiceAttachment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ properties:
- !ruby/object:Api::Type::Boolean
name: 'enableProxyProtocol'
required: true
immutable: true
description: |
If true, enable the proxy protocol which is for supplying client TCP/IP
address data in TCP connections that traverse proxies on their way to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ func TestAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(t *test
ImportStateVerifyIgnore: []string{"target_service", "region"},
},
{
Config: testAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(context),
Config: testAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(context, true),
},
{
ResourceName: "google_compute_service_attachment.psc_ilb_service_attachment",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"target_service", "region"},
},
{
Config: testAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(context, false),
},
{
ResourceName: "google_compute_service_attachment.psc_ilb_service_attachment",
Expand All @@ -48,7 +57,7 @@ resource "google_compute_service_attachment" "psc_ilb_service_attachment" {
region = "us-west2"
description = "A service attachment configured with Terraform"
enable_proxy_protocol = true
enable_proxy_protocol = false
connection_preference = "ACCEPT_AUTOMATIC"
nat_subnets = [google_compute_subnetwork.psc_ilb_nat.id]
target_service = google_compute_forwarding_rule.psc_ilb_target_service.id
Expand Down Expand Up @@ -124,7 +133,15 @@ resource "google_compute_subnetwork" "psc_ilb_nat" {
`, context)
}

func testAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(context map[string]interface{}) string {
func testAccComputeServiceAttachment_serviceAttachmentBasicExampleUpdate(context map[string]interface{}, preventDestroy bool) string {
context["lifecycle_block"] = ""
if preventDestroy {
context["lifecycle_block"] = `
lifecycle {
prevent_destroy = true
}`
}

return acctest.Nprintf(`
resource "google_compute_service_attachment" "psc_ilb_service_attachment" {
name = "tf-test-my-psc-ilb%{random_suffix}"
Expand All @@ -141,8 +158,8 @@ resource "google_compute_service_attachment" "psc_ilb_service_attachment" {
project_id_or_num = "658859330310"
connection_limit = 4
}
reconcile_connections = false
%{lifecycle_block}
}
resource "google_compute_address" "psc_ilb_consumer_address" {
Expand Down

0 comments on commit 5ca51f1

Please sign in to comment.