diff --git a/main.tf b/main.tf index b3cdd9a..b50bad9 100644 --- a/main.tf +++ b/main.tf @@ -71,7 +71,7 @@ module "gw" { name = "${var.hub.name}-vpn" network_name = module.hub_network.name region = var.hub.region - vpn_external_ip = "vpw-gw-us-west1" + vpn_external_ip = var.vpn_external_ip } module "to_lazurowa" { @@ -81,14 +81,8 @@ module "to_lazurowa" { peer_ip = var.peer_ip shared_secret = var.shared_secret - local_selectors = [ - var.hub.cidr, - var.spoke.cidr - ] - - remote_selectors = [ - "192.168.2.0/24", "192.168.10.0/24" - ] + local_selectors = [var.hub.cidr, var.spoke.cidr] + remote_selectors = var.remote_selectors depends_on = [module.gw] } diff --git a/modules/cloud-vpn/variables.tf b/modules/cloud-vpn/variables.tf index 628f62b..4018a55 100644 --- a/modules/cloud-vpn/variables.tf +++ b/modules/cloud-vpn/variables.tf @@ -14,7 +14,7 @@ variable "region" { } variable "vpn_external_ip" { - description = "The name of the external IP address of the VPN Gateway." + description = "External IP address for the VPN gateway. If not provided, a new IP will be allocated." type = string nullable = true default = null diff --git a/variables.tf b/variables.tf index e6fc4d8..ad6f84a 100644 --- a/variables.tf +++ b/variables.tf @@ -19,7 +19,6 @@ variable "spoke" { } variable "ssh" { - description = "SSH Key(s) definition" type = list(object({ public_key = string ssh_user = string @@ -31,13 +30,20 @@ variable "ssh" { }] } +variable "vpn_external_ip" { + type = string + nullable = true +} + variable "peer_ip" { - description = "IP address of the remote peer VPN gateway" - type = string + type = string } variable "shared_secret" { - description = "Shared secret for the VPN tunnel" - type = string - sensitive = true + type = string + sensitive = true +} + +variable "remote_selectors" { + type = list(string) }