12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- # Some of this is redundant or not generated from this module, but it's a nice
- # centralized place to get all of the data needed to setup the VPN connections.
- output vpn_info {
- value = [
- for index, connection in aws_vpn_connection.vpn:
- {
- "cgw_public_ip" = var.interconnect_public_ips[index]
- "cgw_private_ip" = var.interconnect_private_ips[index]
- "cgw_neighbor_ips" = [ for ip in var.interconnect_private_ips: ip if ip != var.interconnect_private_ips[index] ]
- "vgw_public_ips" = [
- connection.tunnel1_address,
- connection.tunnel2_address
- ],
- "cgw_inside_address" = [
- connection.tunnel1_cgw_inside_address,
- connection.tunnel2_cgw_inside_address
- ],
- "vgw_inside_address" = [
- connection.tunnel1_vgw_inside_address,
- connection.tunnel2_vgw_inside_address
- ]
- # This is sensitive, so terraform will redact the output. To get it anyway, do a `terragrunt output vpn_info`
- "preshared_key" = [
- connection.tunnel1_preshared_key,
- connection.tunnel2_preshared_key
- ]
- "vgw_bgp_asn" = connection.tunnel1_bgp_asn, # Tunnel 1 and 2 are same
- "cgw_bgp_asn" = var.interconnect_asn
- }
- ]
- sensitive = true # We need the VPN keys
- }
- output yaml {
- # The contents are the same as above, in an environment key
- value = yamlencode({
- "" = {
- (var.aws_partition_alias) = [
- for index, connection in aws_vpn_connection.vpn:
- {
- "cgw_public_ip" = var.interconnect_public_ips[index]
- "cgw_private_ip" = var.interconnect_private_ips[index]
- "cgw_neighbor_ips" = [ for ip in var.interconnect_private_ips: ip if ip != var.interconnect_private_ips[index] ]
- "vgw_public_ips" = [
- connection.tunnel1_address,
- connection.tunnel2_address
- ],
- "cgw_inside_address" = [
- connection.tunnel1_cgw_inside_address,
- connection.tunnel2_cgw_inside_address
- ],
- "vgw_inside_address" = [
- connection.tunnel1_vgw_inside_address,
- connection.tunnel2_vgw_inside_address
- ]
- "preshared_key" = [
- connection.tunnel1_preshared_key,
- connection.tunnel2_preshared_key
- ]
- "vgw_bgp_asn" = connection.tunnel1_bgp_asn, # Tunnel 1 and 2 are same
- "cgw_bgp_asn" = var.interconnect_asn
- }
- ]
- }
- })
- sensitive = true # We need the VPN keys
- }
|