openinfrastructure / terraform-google-multinic

Connect two VPC networks with an auto-healing, auto-scaling group of IP router instances.
Apache License 2.0
10 stars 5 forks source link

Remove nic0_cidrs, NIC0_CIDRS, nic1_cidrs, NIC1_CIDRS #35

Closed jeffmccune closed 3 years ago

jeffmccune commented 3 years ago

The routing policy has been updated to be "like a wire." Traffic coming in nic0 flows out nic1 and vice-versa, the variables and configuration for the cidr ranges are no longer used.

Remove them from the examples input variables to avoid confusion.

Never used:

❯ rg NIC0_CIDRS
modules/50_compute/templates/startup-script-config.tpl
16:NIC0_CIDRS="${nic0_cidrs}"
❯ rg NIC1_CIDRS
modules/50_compute/templates/startup-script-config.tpl
18:NIC1_CIDRS="${nic1_cidrs}"
jeffmccune commented 3 years ago

Actually, they are used to create the GCP route resources:

resource google_compute_route "via_nic0" {
  for_each     = toset(var.nic0_cidrs)
  name         = "${var.name_prefix}-${local.r_suffix}-${substr(sha1("${var.nic1_network}-${each.value}"), 0, 6)}"
  project      = var.project_id
  network      = var.nic1_network
  dest_range   = each.value
  priority     = var.priority
  next_hop_ilb = google_compute_forwarding_rule.ilb1.self_link
}