@@ -594,12 +594,15 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
594
594
"random_suffix" : suffix ,
595
595
"network_name" : networkName ,
596
596
"enable_public_ip" : true ,
597
+ "enable_outbound_public_ip" : true ,
597
598
"authorized_external_networks" : "" ,
598
599
}
600
+
599
601
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 ,
603
606
"authorized_external_networks" : `
604
607
authorized_external_networks {
605
608
cidr_range = "8.8.8.8/30"
@@ -609,11 +612,13 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
609
612
}
610
613
` ,
611
614
}
615
+
612
616
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" ,
617
622
}
618
623
619
624
acctest .VcrTest (t , resource.TestCase {
@@ -625,6 +630,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
625
630
Config : testAccAlloydbInstance_networkConfig (context1 ),
626
631
Check : resource .ComposeTestCheckFunc (
627
632
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
628
635
),
629
636
},
630
637
{
@@ -640,6 +647,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
640
647
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.0.cidr_range" , "8.8.8.8/30" ),
641
648
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.1.cidr_range" , "8.8.4.4/30" ),
642
649
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" ),
643
652
),
644
653
},
645
654
{
@@ -654,6 +663,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
654
663
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.enable_public_ip" , "true" ),
655
664
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.0.cidr_range" , "8.8.8.8/30" ),
656
665
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" ),
657
668
),
658
669
},
659
670
{
@@ -678,6 +689,7 @@ resource "google_alloydb_instance" "default" {
678
689
679
690
network_config {
680
691
enable_public_ip = %{enable_public_ip}
692
+ enable_outbound_public_ip = %{enable_outbound_public_ip}
681
693
%{authorized_external_networks}
682
694
}
683
695
}
@@ -713,6 +725,7 @@ resource "google_alloydb_instance" "default" {
713
725
714
726
network_config {
715
727
enable_public_ip = %{enable_public_ip}
728
+ enable_outbound_public_ip = %{enable_outbound_public_ip}
716
729
authorized_external_networks {
717
730
cidr_range = "%{cidr_range}"
718
731
}
0 commit comments