@@ -241,6 +241,99 @@ func TestAccSiteVPNConnection_basic(t *testing.T) {
241
241
})
242
242
}
243
243
244
+ func TestAccSiteVPNConnection_withoutTGWorVGW (t * testing.T ) {
245
+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
246
+ rBgpAsn := sdkacctest .RandIntRange (64512 , 65534 )
247
+ resourceName := "aws_vpn_connection.test"
248
+ var vpn ec2.VpnConnection
249
+
250
+ resource .ParallelTest (t , resource.TestCase {
251
+ PreCheck : func () { acctest .PreCheck (t ) },
252
+ ErrorCheck : acctest .ErrorCheck (t , ec2 .EndpointsID ),
253
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
254
+ CheckDestroy : testAccVPNConnectionDestroy ,
255
+ Steps : []resource.TestStep {
256
+ {
257
+ Config : testAccSiteVPNConnectionConfig_withoutTGWorVGW (rName , rBgpAsn ),
258
+ Check : resource .ComposeAggregateTestCheckFunc (
259
+ testAccVPNConnectionExists (resourceName , & vpn ),
260
+ acctest .MatchResourceAttrRegionalARN (resourceName , "arn" , "ec2" , regexp .MustCompile (`vpn-connection/vpn-.+` )),
261
+ resource .TestCheckResourceAttr (resourceName , "core_network_arn" , "" ),
262
+ resource .TestCheckResourceAttr (resourceName , "core_network_attachment_arn" , "" ),
263
+ resource .TestCheckResourceAttrSet (resourceName , "customer_gateway_configuration" ),
264
+ resource .TestCheckResourceAttr (resourceName , "enable_acceleration" , "false" ),
265
+ resource .TestCheckResourceAttr (resourceName , "local_ipv4_network_cidr" , "0.0.0.0/0" ),
266
+ resource .TestCheckResourceAttr (resourceName , "local_ipv6_network_cidr" , "" ),
267
+ resource .TestCheckResourceAttr (resourceName , "outside_ip_address_type" , "PublicIpv4" ),
268
+ resource .TestCheckResourceAttr (resourceName , "remote_ipv4_network_cidr" , "0.0.0.0/0" ),
269
+ resource .TestCheckResourceAttr (resourceName , "remote_ipv6_network_cidr" , "" ),
270
+ resource .TestCheckResourceAttr (resourceName , "routes.#" , "0" ),
271
+ resource .TestCheckResourceAttr (resourceName , "static_routes_only" , "false" ),
272
+ resource .TestCheckResourceAttr (resourceName , "tags.%" , "0" ),
273
+ resource .TestCheckResourceAttr (resourceName , "transit_gateway_attachment_id" , "" ),
274
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel1_address" ),
275
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_bgp_holdtime" , "30" ),
276
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel1_cgw_inside_address" ),
277
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_dpd_timeout_action" , "" ),
278
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_dpd_timeout_seconds" , "0" ),
279
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel1_ike_versions" ),
280
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel1_inside_cidr" ),
281
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_inside_ipv6_cidr" , "" ),
282
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.#" , "1" ),
283
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.#" , "1" ),
284
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_log_options.0.cloudwatch_log_options.0.log_enabled" , "false" ),
285
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel1_phase1_dh_group_numbers" ),
286
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel1_phase1_encryption_algorithms" ),
287
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel1_phase1_integrity_algorithms" ),
288
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_phase1_lifetime_seconds" , "0" ),
289
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel1_phase2_dh_group_numbers" ),
290
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel1_phase2_encryption_algorithms" ),
291
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel1_phase2_integrity_algorithms" ),
292
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_phase2_lifetime_seconds" , "0" ),
293
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel1_preshared_key" ),
294
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_rekey_fuzz_percentage" , "0" ),
295
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_rekey_margin_time_seconds" , "0" ),
296
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_replay_window_size" , "0" ),
297
+ resource .TestCheckResourceAttr (resourceName , "tunnel1_startup_action" , "" ),
298
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel1_vgw_inside_address" ),
299
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel2_address" ),
300
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_bgp_holdtime" , "30" ),
301
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel2_cgw_inside_address" ),
302
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_dpd_timeout_action" , "" ),
303
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_dpd_timeout_seconds" , "0" ),
304
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel2_ike_versions" ),
305
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel2_inside_cidr" ),
306
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_inside_ipv6_cidr" , "" ),
307
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.#" , "1" ),
308
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.0.cloudwatch_log_options.#" , "1" ),
309
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_log_options.0.cloudwatch_log_options.0.log_enabled" , "false" ),
310
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel2_phase1_dh_group_numbers" ),
311
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel2_phase1_encryption_algorithms" ),
312
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel2_phase1_integrity_algorithms" ),
313
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_phase1_lifetime_seconds" , "0" ),
314
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel2_phase2_dh_group_numbers" ),
315
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel2_phase2_encryption_algorithms" ),
316
+ resource .TestCheckNoResourceAttr (resourceName , "tunnel2_phase2_integrity_algorithms" ),
317
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_phase2_lifetime_seconds" , "0" ),
318
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel2_preshared_key" ),
319
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_rekey_fuzz_percentage" , "0" ),
320
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_rekey_margin_time_seconds" , "0" ),
321
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_replay_window_size" , "0" ),
322
+ resource .TestCheckResourceAttr (resourceName , "tunnel2_startup_action" , "" ),
323
+ resource .TestCheckResourceAttrSet (resourceName , "tunnel2_vgw_inside_address" ),
324
+ resource .TestCheckResourceAttr (resourceName , "tunnel_inside_ip_version" , "ipv4" ),
325
+ resource .TestCheckResourceAttr (resourceName , "vgw_telemetry.#" , "2" ),
326
+ ),
327
+ },
328
+ {
329
+ ResourceName : resourceName ,
330
+ ImportState : true ,
331
+ ImportStateVerify : true ,
332
+ },
333
+ },
334
+ })
335
+ }
336
+
244
337
func TestAccSiteVPNConnection_cloudWatchLogOptions (t * testing.T ) {
245
338
rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
246
339
rBgpAsn := sdkacctest .RandIntRange (64512 , 65534 )
@@ -1626,6 +1719,25 @@ resource "aws_vpn_connection" "test" {
1626
1719
` , rName , rBgpAsn )
1627
1720
}
1628
1721
1722
+ func testAccSiteVPNConnectionConfig_withoutTGWorVGW (rName string , rBgpAsn int ) string {
1723
+ return fmt .Sprintf (`
1724
+ resource "aws_customer_gateway" "test" {
1725
+ bgp_asn = %[2]d
1726
+ ip_address = "178.0.0.1"
1727
+ type = "ipsec.1"
1728
+
1729
+ tags = {
1730
+ Name = %[1]q
1731
+ }
1732
+ }
1733
+
1734
+ resource "aws_vpn_connection" "test" {
1735
+ customer_gateway_id = aws_customer_gateway.test.id
1736
+ type = "ipsec.1"
1737
+ }
1738
+ ` , rName , rBgpAsn )
1739
+ }
1740
+
1629
1741
func testAccSiteVPNConnectionConfig_cloudWatchLogOptions (rName string , rBgpAsn int ) string {
1630
1742
return fmt .Sprintf (`
1631
1743
resource "aws_vpn_gateway" "test" {
0 commit comments