Group vpc and subnet under vpc_config
This commit is contained in:
parent
e9312e4dba
commit
b25ee97d15
|
@ -51,7 +51,7 @@ resource "google_network_connectivity_spoke" "spoke-ra" {
|
||||||
resource "google_compute_router" "cr" {
|
resource "google_compute_router" "cr" {
|
||||||
project = var.project_id
|
project = var.project_id
|
||||||
name = "${var.name}-cr"
|
name = "${var.name}-cr"
|
||||||
network = var.vpc
|
network = var.vpc_config.network_name
|
||||||
region = var.region
|
region = var.region
|
||||||
bgp {
|
bgp {
|
||||||
advertise_mode = (
|
advertise_mode = (
|
||||||
|
@ -78,7 +78,7 @@ resource "google_compute_router_interface" "intf1" {
|
||||||
name = "intf1"
|
name = "intf1"
|
||||||
router = google_compute_router.cr.name
|
router = google_compute_router.cr.name
|
||||||
region = var.region
|
region = var.region
|
||||||
subnetwork = var.subnetwork
|
subnetwork = var.vpc_config.subnet_self_link
|
||||||
private_ip_address = var.ip_intf1
|
private_ip_address = var.ip_intf1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ resource "google_compute_router_interface" "intf2" {
|
||||||
name = "intf2"
|
name = "intf2"
|
||||||
router = google_compute_router.cr.name
|
router = google_compute_router.cr.name
|
||||||
region = var.region
|
region = var.region
|
||||||
subnetwork = var.subnetwork
|
subnetwork = var.vpc_config.subnet_self_link
|
||||||
private_ip_address = var.ip_intf2
|
private_ip_address = var.ip_intf2
|
||||||
redundant_interface = google_compute_router_interface.intf1.name
|
redundant_interface = google_compute_router_interface.intf1.name
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,12 +89,10 @@ variable "region" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "subnetwork" {
|
variable "vpc_config" {
|
||||||
description = "The URI of the subnetwork that CR interfaces belong to."
|
description = "Network and subnetwork for the CR interfaces."
|
||||||
type = string
|
type = object({
|
||||||
}
|
network_name = string
|
||||||
|
subnet_self_link = string
|
||||||
variable "vpc" {
|
})
|
||||||
description = "A reference to the network to which the CR belongs."
|
|
||||||
type = string
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue