@@ -400,6 +400,56 @@ func TestAccSiteVPNConnection_cloudWatchLogOptions(t *testing.T) {
400400 })
401401}
402402
403+ func TestAccSiteVPNConnection_cloudWatchLogOptionsBGPLog (t * testing.T ) {
404+ ctx := acctest .Context (t )
405+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
406+ rBgpAsn := sdkacctest .RandIntRange (64512 , 65534 )
407+ resourceName := "aws_vpn_connection.test"
408+ var vpn awstypes.VpnConnection
409+
410+ resource .ParallelTest (t , resource.TestCase {
411+ PreCheck : func () { acctest .PreCheck (ctx , t ) },
412+ ErrorCheck : acctest .ErrorCheck (t , names .EC2ServiceID ),
413+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
414+ CheckDestroy : testAccCheckVPNConnectionDestroy (ctx ),
415+ Steps : []resource.TestStep {
416+ {
417+ Config : testAccVPNConnectionConfig_cloudWatchLogOptionsBGPLog (rName , rBgpAsn ),
418+ Check : resource .ComposeAggregateTestCheckFunc (
419+ testAccVPNConnectionExists (ctx , resourceName , & vpn ),
420+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.#" , "1" ),
421+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.#" , "1" ),
422+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.0.bgp_log_enabled" , acctest .CtTrue ),
423+ resource .TestCheckResourceAttrPair (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.0.bgp_log_group_arn" , "aws_cloudwatch_log_group.test" , names .AttrARN ),
424+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.0.bgp_log_output_format" , names .AttrJSON ),
425+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.#" , "1" ),
426+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.0.cloudwatch_log_options.#" , "1" ),
427+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.0.cloudwatch_log_options.0.bgp_log_enabled" , acctest .CtFalse ),
428+ ),
429+ },
430+ {
431+ ResourceName : resourceName ,
432+ ImportState : true ,
433+ ImportStateVerify : true ,
434+ ImportStateVerifyIgnore : []string {"vgw_telemetry" },
435+ },
436+ {
437+ Config : testAccVPNConnectionConfig_cloudWatchLogOptionsBGPLogUpdated (rName , rBgpAsn ),
438+ Check : resource .ComposeAggregateTestCheckFunc (
439+ testAccVPNConnectionExists (ctx , resourceName , & vpn ),
440+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.#" , "1" ),
441+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.#" , "1" ),
442+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.0.bgp_log_enabled" , acctest .CtFalse ),
443+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.#" , "1" ),
444+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.0.cloudwatch_log_options.0.bgp_log_enabled" , acctest .CtTrue ),
445+ resource .TestCheckResourceAttrPair (resourceName , "tunnel2_log_options.0.cloudwatch_log_options.0.bgp_log_group_arn" , "aws_cloudwatch_log_group.test" , names .AttrARN ),
446+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.0.cloudwatch_log_options.0.bgp_log_output_format" , "text" ),
447+ ),
448+ },
449+ },
450+ })
451+ }
452+
403453func TestAccSiteVPNConnection_transitGatewayID (t * testing.T ) {
404454 ctx := acctest .Context (t )
405455 var vpn awstypes.VpnConnection
@@ -2062,6 +2112,88 @@ resource "aws_vpn_connection" "test" {
20622112` , rName , rBgpAsn )
20632113}
20642114
2115+ func testAccVPNConnectionConfig_cloudWatchLogOptionsBGPLog (rName string , rBgpAsn int ) string {
2116+ return fmt .Sprintf (`
2117+ resource "aws_vpn_gateway" "test" {
2118+ tags = {
2119+ Name = %[1]q
2120+ }
2121+ }
2122+
2123+ resource "aws_customer_gateway" "test" {
2124+ bgp_asn = %[2]d
2125+ ip_address = "178.0.0.1"
2126+ type = "ipsec.1"
2127+
2128+ tags = {
2129+ Name = %[1]q
2130+ }
2131+ }
2132+
2133+ resource "aws_cloudwatch_log_group" "test" {
2134+ name = %[1]q
2135+ }
2136+
2137+ resource "aws_vpn_connection" "test" {
2138+ vpn_gateway_id = aws_vpn_gateway.test.id
2139+ customer_gateway_id = aws_customer_gateway.test.id
2140+ type = "ipsec.1"
2141+
2142+ tunnel1_log_options {
2143+ cloudwatch_log_options {
2144+ bgp_log_enabled = true
2145+ bgp_log_group_arn = aws_cloudwatch_log_group.test.arn
2146+ bgp_log_output_format = "json"
2147+ }
2148+ }
2149+ }
2150+ ` , rName , rBgpAsn )
2151+ }
2152+
2153+ func testAccVPNConnectionConfig_cloudWatchLogOptionsBGPLogUpdated (rName string , rBgpAsn int ) string {
2154+ return fmt .Sprintf (`
2155+ resource "aws_vpn_gateway" "test" {
2156+ tags = {
2157+ Name = %[1]q
2158+ }
2159+ }
2160+
2161+ resource "aws_customer_gateway" "test" {
2162+ bgp_asn = %[2]d
2163+ ip_address = "178.0.0.1"
2164+ type = "ipsec.1"
2165+
2166+ tags = {
2167+ Name = %[1]q
2168+ }
2169+ }
2170+
2171+ resource "aws_cloudwatch_log_group" "test" {
2172+ name = %[1]q
2173+ }
2174+
2175+ resource "aws_vpn_connection" "test" {
2176+ vpn_gateway_id = aws_vpn_gateway.test.id
2177+ customer_gateway_id = aws_customer_gateway.test.id
2178+ type = "ipsec.1"
2179+
2180+ tunnel1_log_options {
2181+ cloudwatch_log_options {
2182+ bgp_log_enabled = false
2183+ }
2184+ }
2185+
2186+ tunnel2_log_options {
2187+ cloudwatch_log_options {
2188+ bgp_log_enabled = true
2189+ bgp_log_group_arn = aws_cloudwatch_log_group.test.arn
2190+ bgp_log_output_format = "text"
2191+ }
2192+ }
2193+ }
2194+ ` , rName , rBgpAsn )
2195+ }
2196+
20652197func testAccVPNConnectionConfig_customerGatewayID (rName string , rBgpAsn1 , rBgpAsn2 int ) string {
20662198 return fmt .Sprintf (`
20672199resource "aws_vpn_gateway" "test" {
0 commit comments