Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making allowPscGlobalAccess in ForwardingRule resource updatable #8772

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading