@@ -596,12 +596,15 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
596
596
"random_suffix" : suffix ,
597
597
"network_name" : networkName ,
598
598
"enable_public_ip" : true ,
599
+ "enable_outbound_public_ip" : true ,
599
600
"authorized_external_networks" : "" ,
600
601
}
602
+
601
603
context2 := map [string ]interface {}{
602
- "random_suffix" : suffix ,
603
- "network_name" : networkName ,
604
- "enable_public_ip" : true ,
604
+ "random_suffix" : suffix ,
605
+ "network_name" : networkName ,
606
+ "enable_public_ip" : true ,
607
+ "enable_outbound_public_ip" : false ,
605
608
"authorized_external_networks" : `
606
609
authorized_external_networks {
607
610
cidr_range = "8.8.8.8/30"
@@ -611,11 +614,13 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
611
614
}
612
615
` ,
613
616
}
617
+
614
618
context3 := map [string ]interface {}{
615
- "random_suffix" : suffix ,
616
- "network_name" : networkName ,
617
- "enable_public_ip" : true ,
618
- "cidr_range" : "8.8.8.8/30" ,
619
+ "random_suffix" : suffix ,
620
+ "network_name" : networkName ,
621
+ "enable_public_ip" : true ,
622
+ "enable_outbound_public_ip" : true ,
623
+ "cidr_range" : "8.8.8.8/30" ,
619
624
}
620
625
621
626
acctest .VcrTest (t , resource.TestCase {
@@ -627,6 +632,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
627
632
Config : testAccAlloydbInstance_networkConfig (context1 ),
628
633
Check : resource .ComposeTestCheckFunc (
629
634
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.enable_public_ip" , "true" ),
635
+ resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.enable_outbound_public_ip" , "true" ),
636
+ resource .TestCheckResourceAttrSet ("google_alloydb_instance.default" , "outbound_public_ip_addresses.0" ), // Ensure it's set
630
637
),
631
638
},
632
639
{
@@ -642,6 +649,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
642
649
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.0.cidr_range" , "8.8.8.8/30" ),
643
650
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.1.cidr_range" , "8.8.4.4/30" ),
644
651
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.#" , "2" ),
652
+ resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.enable_outbound_public_ip" , "false" ),
653
+ resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "outbound_public_ip_addresses.#" , "0" ),
645
654
),
646
655
},
647
656
{
@@ -656,6 +665,8 @@ func TestAccAlloydbInstance_networkConfig(t *testing.T) {
656
665
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.enable_public_ip" , "true" ),
657
666
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.0.cidr_range" , "8.8.8.8/30" ),
658
667
resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.authorized_external_networks.#" , "1" ),
668
+ resource .TestCheckResourceAttr ("google_alloydb_instance.default" , "network_config.0.enable_outbound_public_ip" , "true" ),
669
+ resource .TestCheckResourceAttrSet ("google_alloydb_instance.default" , "outbound_public_ip_addresses.0" ),
659
670
),
660
671
},
661
672
{
@@ -680,6 +691,7 @@ resource "google_alloydb_instance" "default" {
680
691
681
692
network_config {
682
693
enable_public_ip = %{enable_public_ip}
694
+ enable_outbound_public_ip = %{enable_outbound_public_ip}
683
695
%{authorized_external_networks}
684
696
}
685
697
}
@@ -715,6 +727,7 @@ resource "google_alloydb_instance" "default" {
715
727
716
728
network_config {
717
729
enable_public_ip = %{enable_public_ip}
730
+ enable_outbound_public_ip = %{enable_outbound_public_ip}
718
731
authorized_external_networks {
719
732
cidr_range = "%{cidr_range}"
720
733
}
0 commit comments