outputs.tf 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Some of this is redundant or not generated from this module, but it's a nice
  2. # centralized place to get all of the data needed to setup the VPN connections.
  3. output vpn_info {
  4. value = [
  5. for index, connection in aws_vpn_connection.vpn:
  6. {
  7. "cgw_public_ip" = var.interconnect_public_ips[index]
  8. "cgw_private_ip" = var.interconnect_private_ips[index]
  9. "cgw_neighbor_ips" = [ for ip in var.interconnect_private_ips: ip if ip != var.interconnect_private_ips[index] ]
  10. "vgw_public_ips" = [
  11. connection.tunnel1_address,
  12. connection.tunnel2_address
  13. ],
  14. "cgw_inside_address" = [
  15. connection.tunnel1_cgw_inside_address,
  16. connection.tunnel2_cgw_inside_address
  17. ],
  18. "vgw_inside_address" = [
  19. connection.tunnel1_vgw_inside_address,
  20. connection.tunnel2_vgw_inside_address
  21. ]
  22. # This is sensitive, so terraform will redact the output. To get it anyway, do a `terragrunt output vpn_info`
  23. "preshared_key" = [
  24. connection.tunnel1_preshared_key,
  25. connection.tunnel2_preshared_key
  26. ]
  27. "vgw_bgp_asn" = connection.tunnel1_bgp_asn, # Tunnel 1 and 2 are same
  28. "cgw_bgp_asn" = var.interconnect_asn
  29. }
  30. ]
  31. sensitive = true # We need the VPN keys
  32. }
  33. output yaml {
  34. # The contents are the same as above, in an environment key
  35. value = yamlencode({
  36. "" = {
  37. (var.aws_partition_alias) = [
  38. for index, connection in aws_vpn_connection.vpn:
  39. {
  40. "cgw_public_ip" = var.interconnect_public_ips[index]
  41. "cgw_private_ip" = var.interconnect_private_ips[index]
  42. "cgw_neighbor_ips" = [ for ip in var.interconnect_private_ips: ip if ip != var.interconnect_private_ips[index] ]
  43. "vgw_public_ips" = [
  44. connection.tunnel1_address,
  45. connection.tunnel2_address
  46. ],
  47. "cgw_inside_address" = [
  48. connection.tunnel1_cgw_inside_address,
  49. connection.tunnel2_cgw_inside_address
  50. ],
  51. "vgw_inside_address" = [
  52. connection.tunnel1_vgw_inside_address,
  53. connection.tunnel2_vgw_inside_address
  54. ]
  55. "preshared_key" = [
  56. connection.tunnel1_preshared_key,
  57. connection.tunnel2_preshared_key
  58. ]
  59. "vgw_bgp_asn" = connection.tunnel1_bgp_asn, # Tunnel 1 and 2 are same
  60. "cgw_bgp_asn" = var.interconnect_asn
  61. }
  62. ]
  63. }
  64. })
  65. sensitive = true # We need the VPN keys
  66. }