Bring back vpn_gateway_create var in net-vpn-ha

This commit is contained in:
Julio Castillo 2022-11-30 15:22:42 +01:00
parent e976d71428
commit fcb697c935
2 changed files with 9 additions and 3 deletions

View File

@ -22,7 +22,7 @@ locals {
: var.router_config.name
)
vpn_gateway = (
var.vpn_gateway == null
var.vpn_gateway_create
? try(google_compute_ha_vpn_gateway.ha_gateway[0].self_link, null)
: var.vpn_gateway
)
@ -30,7 +30,7 @@ locals {
}
resource "google_compute_ha_vpn_gateway" "ha_gateway" {
count = var.vpn_gateway == null ? 1 : 0
count = var.vpn_gateway_create ? 1 : 0
name = var.name
project = var.project_id
region = var.region

View File

@ -93,7 +93,13 @@ variable "tunnels" {
}
variable "vpn_gateway" {
description = "Self link of an existing HA VPN Gateway to use. Set to null to create new VPN Gateway."
description = "HA VPN Gateway Self Link for using an existing HA VPN Gateway. Ignored if `vpn_gateway_create` is set to `true`."
type = string
default = null
}
variable "vpn_gateway_create" {
description = "Create HA VPN Gateway."
type = bool
default = true
}