Skip to content

Commit

Permalink
making allowPscGlobalAccess updatable (GoogleCloudPlatform#8772)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipegc authored and joelkattapuram committed Sep 20, 2023
1 parent a596aec commit 539fbec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions mmv1/products/compute/ForwardingRule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,10 @@ properties:
This is used in PSC consumer ForwardingRule to control whether the PSC
endpoint can be accessed from another region.
send_empty_value: true
update_verb: :PATCH
update_url: projects/{{project}}/regions/{{region}}/forwardingRules/{{name}}
update_id: 'allowPscGlobalAccess'
fingerprint_name: 'fingerprint'
- !ruby/object:Api::Type::Boolean
name: noAutomateDnsZone
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,18 @@ func TestAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate(t *testing.T
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
Config: testAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate(context),
{
Config: testAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate(context, true),
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.default",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate(context, false),
},
{
ResourceName: "google_compute_forwarding_rule.default",
ImportState: true,
ImportStateVerify: true,
Expand Down Expand Up @@ -549,7 +557,15 @@ resource "google_service_directory_service" "examplesvc" {
}
<% end -%>

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

return acctest.Nprintf(`
// Forwarding rule for VPC private service connect
resource "google_compute_forwarding_rule" "default" {
Expand All @@ -560,6 +576,7 @@ resource "google_compute_forwarding_rule" "default" {
network = google_compute_network.consumer_net.name
ip_address = google_compute_address.consumer_address.id
allow_psc_global_access = false
%{lifecycle_block}
}

// Consumer service endpoint
Expand Down

0 comments on commit 539fbec

Please sign in to comment.