5
5
transit_gateway_enabled = local. enabled && var. transit_gateway_enabled
6
6
7
7
transit_gateway_attachment_id = join (" " , aws_vpn_connection. default [* ]. transit_gateway_attachment_id )
8
- vpn_gateway_id = join ( " " , aws_vpn_gateway. default [* ]. id )
8
+ vpn_gateway_id = one ( aws_vpn_gateway. default [* ]. id )
9
9
customer_gateway_id = join (" " , aws_customer_gateway. default [* ]. id )
10
10
vpn_connection_id = join (" " , aws_vpn_connection. default [* ]. id )
11
11
}
@@ -20,11 +20,12 @@ resource "aws_vpn_gateway" "default" {
20
20
21
21
# https://www.terraform.io/docs/providers/aws/r/customer_gateway.html
22
22
resource "aws_customer_gateway" "default" {
23
- count = local. enabled && var. customer_gateway_ip_address != null ? 1 : 0
24
- bgp_asn = var. customer_gateway_bgp_asn
25
- ip_address = var. customer_gateway_ip_address
26
- type = " ipsec.1"
27
- tags = module. this . tags
23
+ count = local. enabled && var. customer_gateway_ip_address != null ? 1 : 0
24
+ device_name = module. this . id
25
+ bgp_asn = var. customer_gateway_bgp_asn
26
+ ip_address = var. customer_gateway_ip_address
27
+ type = " ipsec.1"
28
+ tags = module. this . tags
28
29
}
29
30
30
31
module "logs" {
@@ -96,7 +97,7 @@ resource "aws_vpn_connection" "default" {
96
97
97
98
# https://www.terraform.io/docs/providers/aws/r/vpn_gateway_route_propagation.html
98
99
resource "aws_vpn_gateway_route_propagation" "default" {
99
- count = local. enabled ? length (var. route_table_ids ) : 0
100
+ count = local. enabled && ! var . transit_gateway_enabled ? length (var. route_table_ids ) : 0
100
101
vpn_gateway_id = local. vpn_gateway_id
101
102
route_table_id = element (var. route_table_ids , count. index )
102
103
}
0 commit comments