remote_subnet is required for dynamic tunnel
orkenstein opened this issue · 4 comments
Even when set up to use dynamic, requires remote_subnet
, otherwise returns:
$ terraform apply
Error: module.vpn-module-dynamic.google_compute_route.route: 1 error(s) occurred:
* module.vpn-module-dynamic.google_compute_route.route: __builtin_IntMath: divide by zero in:
${element(var.remote_subnet, (count.index%length(var.remote_subnet)))}
Configuration:
resource "google_compute_router" "vpn_cloud_router" {
name = "vpn-cloud-router"
region = "${var.region}"
network = "${var.network}"
project = "${var.project}"
bgp {
asn = "64515"
}
}
module "vpn-module-dynamic" {
source = "terraform-google-modules/vpn/google"
project_id = "${var.project}"
network = "${var.network}"
region = "${var.region}"
gateway_name = "vpn-gw-dynamic"
tunnel_name_prefix = "vpn-tn-dynamic"
shared_secret = "secrets"
tunnel_count = 1
peer_ips = ["1.1.1.1"]
cr_name = "${google_compute_router.vpn_cloud_router.name}"
bgp_cr_session_range = ["169.254.0.1/30", "169.254.0.3/30"]
bgp_remote_session_range = ["169.254.0.2", "169.254.0.4"]
peer_asn = ["64516", "64517"]
remote_subnet = ["10.200.10.0/24", "10.200.20.0/24"]
}
Is this just a documentation issue? @andreyk-code can you help?
Have you tried using the string of the cloud router name in the "cr_name" arg instead of using the resource? Don't think the resource name is passable into the module.
cr_name = "vpn-cloud-router"
Please take a look at the /examples/multi-tunnel files for more reference.
cr_name = "vpn-cloud-router"
Yeah, this helps. Is it possible to pass the resource instead somehow?
@andreyk-code Can you clarify why the name
of a google_compute_router
is not a valid value for cr_name
? The offending count
which is triggering this issue should be 0
unless cr_name
is empty.