Skip to content

Public outbound ip #11675

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

Merged
merged 6 commits into from
Sep 11, 2024
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
12 changes: 12 additions & 0 deletions mmv1/products/alloydb/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,22 @@ properties:
Enabling public ip for the instance. If a user wishes to disable this,
please also clear the list of the authorized external networks set on
the same instance.
- !ruby/object:Api::Type::Boolean
name: enableOutboundPublicIp
description: |
Enabling outbound public ip for the instance.
- !ruby/object:Api::Type::String
name: 'publicIpAddress'
output: true
description: |
The public IP addresses for the Instance. This is available ONLY when
networkConfig.enablePublicIp is set to true. This is the connection
endpoint for an end-user application.
- !ruby/object:Api::Type::Array
item_type: Api::Type::String
name: 'outboundPublicIpAddresses'
output: true
description: |
The outbound public IP addresses for the instance. This is available ONLY when
networkConfig.enableOutboundPublicIp is set to true. These IP addresses are used
for outbound connections.
Original file line number Diff line number Diff line change
Expand Up @@ -594,12 +594,15 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
"random_suffix": suffix,
"network_name": networkName,
"enable_public_ip": true,
"enable_outbound_public_ip": true,
"authorized_external_networks": "",
}

context2 := map[string]interface{}{
"random_suffix": suffix,
"network_name": networkName,
"enable_public_ip": true,
"random_suffix": suffix,
"network_name": networkName,
"enable_public_ip": true,
"enable_outbound_public_ip": false,
"authorized_external_networks": `
authorized_external_networks {
cidr_range = "8.8.8.8/30"
Expand All @@ -609,11 +612,13 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
}
`,
}

context3 := map[string]interface{}{
"random_suffix": suffix,
"network_name": networkName,
"enable_public_ip": true,
"cidr_range": "8.8.8.8/30",
"random_suffix": suffix,
"network_name": networkName,
"enable_public_ip": true,
"enable_outbound_public_ip": true,
"cidr_range": "8.8.8.8/30",
}

acctest.VcrTest(t, resource.TestCase{
Expand All @@ -625,6 +630,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
Config: testAccAlloydbInstance_networkConfig(context1),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_public_ip", "true"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_outbound_public_ip", "true"),
resource.TestCheckResourceAttrSet("google_alloydb_instance.default", "outbound_public_ip_addresses.0"), // Ensure it's set
),
},
{
Expand All @@ -640,6 +647,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.0.cidr_range", "8.8.8.8/30"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.1.cidr_range", "8.8.4.4/30"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.#", "2"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_outbound_public_ip", "false"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "outbound_public_ip_addresses.#", "0"),
),
},
{
Expand All @@ -654,6 +663,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_public_ip", "true"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.0.cidr_range", "8.8.8.8/30"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.authorized_external_networks.#", "1"),
resource.TestCheckResourceAttr("google_alloydb_instance.default", "network_config.0.enable_outbound_public_ip", "true"),
resource.TestCheckResourceAttrSet("google_alloydb_instance.default", "outbound_public_ip_addresses.0"),
),
},
{
Expand All @@ -678,6 +689,7 @@ resource "google_alloydb_instance" "default" {

network_config {
enable_public_ip = %{enable_public_ip}
enable_outbound_public_ip = %{enable_outbound_public_ip}
%{authorized_external_networks}
}
}
Expand Down Expand Up @@ -713,6 +725,7 @@ resource "google_alloydb_instance" "default" {

network_config {
enable_public_ip = %{enable_public_ip}
enable_outbound_public_ip = %{enable_outbound_public_ip}
authorized_external_networks {
cidr_range = "%{cidr_range}"
}
Expand Down
Loading