make the vpn ha module more resilient on destroy

This commit is contained in:
Ludovico Magnocavallo
2020-04-28 19:43:42 +02:00
parent 560fb3ac3c
commit 5088ed61ff
2 changed files with 4 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ locals {
)
router = (
var.router_create
? google_compute_router.router[0].name
? try(google_compute_router.router[0].name, null)
: var.router_name
)
secret = random_id.secret.b64_url

View File

@@ -53,7 +53,7 @@ output "tunnels" {
description = "VPN tunnel resources."
value = {
for name in keys(var.tunnels) :
name => google_compute_vpn_tunnel.tunnels[name]
name => try(google_compute_vpn_tunnel.tunnels[name], null)
}
}
@@ -61,7 +61,7 @@ output "tunnel_names" {
description = "VPN tunnel names."
value = {
for name in keys(var.tunnels) :
name => google_compute_vpn_tunnel.tunnels[name].name
name => try(google_compute_vpn_tunnel.tunnels[name].name, null)
}
}
@@ -69,7 +69,7 @@ output "tunnel_self_links" {
description = "VPN tunnel self links."
value = {
for name in keys(var.tunnels) :
name => google_compute_vpn_tunnel.tunnels[name].self_link
name => try(google_compute_vpn_tunnel.tunnels[name].self_link, null)
}
}