Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to autogenerate md5 keys in net-vpn-ha #2748

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
restore missing output
  • Loading branch information
ludoo committed Dec 6, 2024
commit 545d4b0a74c7b492fc641a359ae6e48bb9406d91
17 changes: 9 additions & 8 deletions modules/net-vpn-ha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,13 @@ You can optionally avoid to specify MD5 keys and the module will automatically g
| [gateway](outputs.tf#L30) | VPN gateway resource (only if auto-created). | |
| [id](outputs.tf#L35) | Fully qualified VPN gateway id. | |
| [md5_keys](outputs.tf#L42) | BGP tunnels MD5 keys. | |
| [name](outputs.tf#L56) | VPN gateway name (only if auto-created). | |
| [router](outputs.tf#L61) | Router resource (only if auto-created). | |
| [router_name](outputs.tf#L66) | Router name. | |
| [self_link](outputs.tf#L71) | HA VPN gateway self link. | |
| [shared_secrets](outputs.tf#L76) | IPSEC tunnels shared secrets. | |
| [tunnel_names](outputs.tf#L84) | VPN tunnel names. | |
| [tunnel_self_links](outputs.tf#L92) | VPN tunnel self links. | |
| [tunnels](outputs.tf#L100) | VPN tunnel resources. | |
| [name](outputs.tf#L53) | VPN gateway name (only if auto-created). | |
| [random_secret](outputs.tf#L58) | Generated secret. | |
| [router](outputs.tf#L63) | Router resource (only if auto-created). | |
| [router_name](outputs.tf#L68) | Router name. | |
| [self_link](outputs.tf#L73) | HA VPN gateway self link. | |
| [shared_secrets](outputs.tf#L78) | IPSEC tunnels shared secrets. | |
| [tunnel_names](outputs.tf#L86) | VPN tunnel names. | |
| [tunnel_self_links](outputs.tf#L94) | VPN tunnel self links. | |
| [tunnels](outputs.tf#L102) | VPN tunnel resources. | |
<!-- END TFDOC -->
18 changes: 10 additions & 8 deletions modules/net-vpn-ha/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ output "id" {
output "md5_keys" {
description = "BGP tunnels MD5 keys."
value = {
for k, v in var.tunnels
: k => (
try(v.bgp_peer.md5_authentication_key) == null
? {} : {
key = coalesce(v.bgp_peer.md5_authentication_key.key, local.md5_keys[k])
name = v.bgp_peer.md5_authentication_key.name
}
)
for k, v in var.tunnels :
k => try(v.bgp_peer.md5_authentication_key, null) == null ? {} : {
key = coalesce(v.bgp_peer.md5_authentication_key.key, local.md5_keys[k])
name = v.bgp_peer.md5_authentication_key.name
}
}
}

Expand All @@ -58,6 +55,11 @@ output "name" {
value = one(google_compute_ha_vpn_gateway.ha_gateway[*].name)
}

output "random_secret" {
description = "Generated secret."
value = local.secret
}

output "router" {
description = "Router resource (only if auto-created)."
value = one(google_compute_router.router[*])
Expand Down
Loading