Improvements to NCC-RA spoke module. (#1267)
This commit is contained in:
parent
6e49e94749
commit
3b20d617dc
|
@ -23,8 +23,8 @@ module "spoke-ra" {
|
||||||
]
|
]
|
||||||
router_config = {
|
router_config = {
|
||||||
asn = 65000
|
asn = 65000
|
||||||
ip_interface1 = "10.0.0.14"
|
ip_interface0 = "10.0.0.14"
|
||||||
ip_interface2 = "10.0.0.15"
|
ip_interface1 = "10.0.0.15"
|
||||||
peer_asn = 65001
|
peer_asn = 65001
|
||||||
}
|
}
|
||||||
vpc_config = {
|
vpc_config = {
|
||||||
|
@ -52,8 +52,8 @@ module "spoke-ra-a" {
|
||||||
]
|
]
|
||||||
router_config = {
|
router_config = {
|
||||||
asn = 65000
|
asn = 65000
|
||||||
ip_interface1 = "10.0.0.14"
|
ip_interface0 = "10.0.0.14"
|
||||||
ip_interface2 = "10.0.0.15"
|
ip_interface1 = "10.0.0.15"
|
||||||
peer_asn = 65001
|
peer_asn = 65001
|
||||||
}
|
}
|
||||||
vpc_config = {
|
vpc_config = {
|
||||||
|
@ -76,8 +76,8 @@ module "spoke-ra-b" {
|
||||||
]
|
]
|
||||||
router_config = {
|
router_config = {
|
||||||
asn = 65000
|
asn = 65000
|
||||||
ip_interface1 = "10.0.0.14"
|
ip_interface0 = "10.0.0.14"
|
||||||
ip_interface2 = "10.0.0.15"
|
ip_interface1 = "10.0.0.15"
|
||||||
peer_asn = 65002
|
peer_asn = 65002
|
||||||
}
|
}
|
||||||
vpc_config = {
|
vpc_config = {
|
||||||
|
@ -115,8 +115,8 @@ module "spoke-ra" {
|
||||||
"10.10.0.0/24" = "peered-vpc"
|
"10.10.0.0/24" = "peered-vpc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ip_interface1 = "10.0.0.14"
|
ip_interface0 = "10.0.0.14"
|
||||||
ip_interface2 = "10.0.0.15"
|
ip_interface1 = "10.0.0.15"
|
||||||
peer_asn = 65001
|
peer_asn = 65001
|
||||||
}
|
}
|
||||||
vpc_config = {
|
vpc_config = {
|
||||||
|
@ -137,8 +137,8 @@ module "spoke-ra" {
|
||||||
| [project_id](variables.tf#L37) | The ID of the project where the NCC hub & spokes will be created. | <code>string</code> | ✓ | |
|
| [project_id](variables.tf#L37) | The ID of the project where the NCC hub & spokes will be created. | <code>string</code> | ✓ | |
|
||||||
| [region](variables.tf#L42) | Region where the spoke is located. | <code>string</code> | ✓ | |
|
| [region](variables.tf#L42) | Region where the spoke is located. | <code>string</code> | ✓ | |
|
||||||
| [router_appliances](variables.tf#L47) | List of router appliances this spoke is associated with. | <code title="list(object({ internal_ip = string vm_self_link = string }))">list(object({…}))</code> | ✓ | |
|
| [router_appliances](variables.tf#L47) | List of router appliances this spoke is associated with. | <code title="list(object({ internal_ip = string vm_self_link = string }))">list(object({…}))</code> | ✓ | |
|
||||||
| [router_config](variables.tf#L55) | Configuration of the Cloud Router. | <code title="object({ asn = number custom_advertise = optional(object({ all_subnets = bool ip_ranges = map(string) })) ip_interface1 = string ip_interface2 = string keepalive = optional(number) peer_asn = number })">object({…})</code> | ✓ | |
|
| [router_config](variables.tf#L55) | Configuration of the Cloud Router. | <code title="object({ asn = number custom_advertise = optional(object({ all_subnets = bool ip_ranges = map(string) })) ip_interface0 = string ip_interface1 = string keepalive = optional(number) peer_asn = number routes_priority = optional(number, 100) })">object({…})</code> | ✓ | |
|
||||||
| [vpc_config](variables.tf#L70) | Network and subnetwork for the CR interfaces. | <code title="object({ network_name = string subnet_self_link = string })">object({…})</code> | ✓ | |
|
| [vpc_config](variables.tf#L71) | Network and subnetwork for the CR interfaces. | <code title="object({ network_name = string subnet_self_link = string })">object({…})</code> | ✓ | |
|
||||||
| [data_transfer](variables.tf#L17) | Site-to-site data transfer feature, available only in some regions. | <code>bool</code> | | <code>false</code> |
|
| [data_transfer](variables.tf#L17) | Site-to-site data transfer feature, available only in some regions. | <code>bool</code> | | <code>false</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
|
@ -75,48 +75,50 @@ resource "google_compute_router" "cr" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_router_interface" "intf1" {
|
resource "google_compute_router_interface" "intf_0" {
|
||||||
project = var.project_id
|
project = var.project_id
|
||||||
name = "intf1"
|
name = "${google_compute_router.cr.name}-intf0"
|
||||||
router = google_compute_router.cr.name
|
router = google_compute_router.cr.name
|
||||||
region = var.region
|
region = var.region
|
||||||
subnetwork = var.vpc_config.subnet_self_link
|
subnetwork = var.vpc_config.subnet_self_link
|
||||||
private_ip_address = var.router_config.ip_interface1
|
private_ip_address = var.router_config.ip_interface0
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_router_interface" "intf2" {
|
resource "google_compute_router_interface" "intf_1" {
|
||||||
project = var.project_id
|
project = var.project_id
|
||||||
name = "intf2"
|
name = "${google_compute_router.cr.name}-intf1"
|
||||||
router = google_compute_router.cr.name
|
router = google_compute_router.cr.name
|
||||||
region = var.region
|
region = var.region
|
||||||
subnetwork = var.vpc_config.subnet_self_link
|
subnetwork = var.vpc_config.subnet_self_link
|
||||||
private_ip_address = var.router_config.ip_interface2
|
private_ip_address = var.router_config.ip_interface1
|
||||||
redundant_interface = google_compute_router_interface.intf1.name
|
redundant_interface = google_compute_router_interface.intf_0.name
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_router_peer" "peer1" {
|
resource "google_compute_router_peer" "peer_0" {
|
||||||
for_each = {
|
for_each = {
|
||||||
for idx, entry in local.spoke_vms : idx => entry
|
for idx, entry in local.spoke_vms : idx => entry
|
||||||
}
|
}
|
||||||
project = var.project_id
|
project = var.project_id
|
||||||
name = "peer1-${each.value.vm_name}"
|
name = "${google_compute_router.cr.name}-${each.value.vm_name}-peer1"
|
||||||
router = google_compute_router.cr.name
|
router = google_compute_router.cr.name
|
||||||
region = var.region
|
region = var.region
|
||||||
interface = google_compute_router_interface.intf1.name
|
advertised_route_priority = var.router_config.routes_priority
|
||||||
|
interface = google_compute_router_interface.intf_0.name
|
||||||
peer_asn = var.router_config.peer_asn
|
peer_asn = var.router_config.peer_asn
|
||||||
peer_ip_address = each.value.ip
|
peer_ip_address = each.value.ip
|
||||||
router_appliance_instance = each.value.vm
|
router_appliance_instance = each.value.vm
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_router_peer" "peer2" {
|
resource "google_compute_router_peer" "peer_1" {
|
||||||
for_each = {
|
for_each = {
|
||||||
for idx, entry in local.spoke_vms : idx => entry
|
for idx, entry in local.spoke_vms : idx => entry
|
||||||
}
|
}
|
||||||
project = var.project_id
|
project = var.project_id
|
||||||
name = "peer2-${each.value.vm_name}"
|
name = "${google_compute_router.cr.name}-${each.value.vm_name}-peer2"
|
||||||
router = google_compute_router.cr.name
|
router = google_compute_router.cr.name
|
||||||
region = var.region
|
region = var.region
|
||||||
interface = google_compute_router_interface.intf2.name
|
advertised_route_priority = var.router_config.routes_priority
|
||||||
|
interface = google_compute_router_interface.intf_1.name
|
||||||
peer_asn = var.router_config.peer_asn
|
peer_asn = var.router_config.peer_asn
|
||||||
peer_ip_address = each.value.ip
|
peer_ip_address = each.value.ip
|
||||||
router_appliance_instance = each.value.vm
|
router_appliance_instance = each.value.vm
|
||||||
|
|
|
@ -60,10 +60,11 @@ variable "router_config" {
|
||||||
all_subnets = bool
|
all_subnets = bool
|
||||||
ip_ranges = map(string)
|
ip_ranges = map(string)
|
||||||
}))
|
}))
|
||||||
ip_interface1 = string
|
ip_interface0 = string
|
||||||
ip_interface2 = string
|
ip_interface1 = string
|
||||||
keepalive = optional(number)
|
keepalive = optional(number)
|
||||||
peer_asn = number
|
peer_asn = number
|
||||||
|
routes_priority = optional(number, 100)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue