Skip to content

Commit 7dbf677

Browse files
prabhav2302Philip Jonany
authored and
Philip Jonany
committed
Public outbound ip (GoogleCloudPlatform#11675)
1 parent a8be7f6 commit 7dbf677

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

mmv1/products/alloydb/Instance.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,22 @@ properties:
370370
Enabling public ip for the instance. If a user wishes to disable this,
371371
please also clear the list of the authorized external networks set on
372372
the same instance.
373+
- !ruby/object:Api::Type::Boolean
374+
name: enableOutboundPublicIp
375+
description: |
376+
Enabling outbound public ip for the instance.
373377
- !ruby/object:Api::Type::String
374378
name: 'publicIpAddress'
375379
output: true
376380
description: |
377381
The public IP addresses for the Instance. This is available ONLY when
378382
networkConfig.enablePublicIp is set to true. This is the connection
379383
endpoint for an end-user application.
384+
- !ruby/object:Api::Type::Array
385+
item_type: Api::Type::String
386+
name: 'outboundPublicIpAddresses'
387+
output: true
388+
description: |
389+
The outbound public IP addresses for the instance. This is available ONLY when
390+
networkConfig.enableOutboundPublicIp is set to true. These IP addresses are used
391+
for outbound connections.

mmv1/third_party/terraform/services/alloydb/resource_alloydb_instance_test.go

+20-7
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,15 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
594594
"random_suffix": suffix,
595595
"network_name": networkName,
596596
"enable_public_ip": true,
597+
"enable_outbound_public_ip": true,
597598
"authorized_external_networks": "",
598599
}
600+
599601
context2 := map[string]interface{}{
600-
"random_suffix": suffix,
601-
"network_name": networkName,
602-
"enable_public_ip": true,
602+
"random_suffix": suffix,
603+
"network_name": networkName,
604+
"enable_public_ip": true,
605+
"enable_outbound_public_ip": false,
603606
"authorized_external_networks": `
604607
authorized_external_networks {
605608
cidr_range = "8.8.8.8/30"
@@ -609,11 +612,13 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
609612
}
610613
`,
611614
}
615+
612616
context3 := map[string]interface{}{
613-
"random_suffix": suffix,
614-
"network_name": networkName,
615-
"enable_public_ip": true,
616-
"cidr_range": "8.8.8.8/30",
617+
"random_suffix": suffix,
618+
"network_name": networkName,
619+
"enable_public_ip": true,
620+
"enable_outbound_public_ip": true,
621+
"cidr_range": "8.8.8.8/30",
617622
}
618623

619624
acctest.VcrTest(t, resource.TestCase{
@@ -625,6 +630,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
625630
Config: testAccAlloydbInstance_networkConfig(context1),
626631
Check: resource.ComposeTestCheckFunc(
627632
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_public_ip", "true"),
633+
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_outbound_public_ip", "true"),
634+
resource.TestCheckResourceAttrSet("google_alloydb_instance.default", "outbound_public_ip_addresses.0"), // Ensure it's set
628635
),
629636
},
630637
{
@@ -640,6 +647,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
640647
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.0.cidr_range", "8.8.8.8/30"),
641648
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.1.cidr_range", "8.8.4.4/30"),
642649
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.#", "2"),
650+
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_outbound_public_ip", "false"),
651+
resource.TestCheckResourceAttr("google_alloydb_instance.default", "outbound_public_ip_addresses.#", "0"),
643652
),
644653
},
645654
{
@@ -654,6 +663,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
654663
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_public_ip", "true"),
655664
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.0.cidr_range", "8.8.8.8/30"),
656665
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.#", "1"),
666+
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_outbound_public_ip", "true"),
667+
resource.TestCheckResourceAttrSet("google_alloydb_instance.default", "outbound_public_ip_addresses.0"),
657668
),
658669
},
659670
{
@@ -678,6 +689,7 @@ resource "google_alloydb_instance" "default" {
678689
679690
network_config {
680691
enable_public_ip = %{enable_public_ip}
692+
enable_outbound_public_ip = %{enable_outbound_public_ip}
681693
%{authorized_external_networks}
682694
}
683695
}
@@ -713,6 +725,7 @@ resource "google_alloydb_instance" "default" {
713725
714726
network_config {
715727
enable_public_ip = %{enable_public_ip}
728+
enable_outbound_public_ip = %{enable_outbound_public_ip}
716729
authorized_external_networks {
717730
cidr_range = "%{cidr_range}"
718731
}

0 commit comments

Comments
 (0)