2020-08-15 01:12:43 -07:00
|
|
|
/**
|
2022-01-01 06:52:31 -08:00
|
|
|
* Copyright 2022 Google LLC
|
2020-08-15 01:12:43 -07:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
module "vpc-right" {
|
2022-01-10 06:09:38 -08:00
|
|
|
source = "../../../modules/net-vpc"
|
2020-08-15 01:12:43 -07:00
|
|
|
project_id = module.project.project_id
|
2022-11-23 02:09:00 -08:00
|
|
|
name = "${var.prefix}-right"
|
2020-08-15 01:12:43 -07:00
|
|
|
subnets = [
|
|
|
|
{
|
2022-10-14 02:02:33 -07:00
|
|
|
ip_cidr_range = var.ip_ranges.right
|
2022-11-23 02:09:00 -08:00
|
|
|
name = "${var.prefix}-right"
|
2022-10-14 02:02:33 -07:00
|
|
|
region = var.region
|
2020-08-15 01:12:43 -07:00
|
|
|
},
|
|
|
|
]
|
|
|
|
routes = {
|
|
|
|
to-left-ilb = {
|
|
|
|
dest_range = var.ip_ranges.left
|
|
|
|
priority = var.ilb_right_enable ? 900 : 1100
|
|
|
|
next_hop_type = "ilb"
|
|
|
|
next_hop = module.ilb-right.forwarding_rule.self_link
|
|
|
|
}
|
|
|
|
to-left-gw-1 = {
|
|
|
|
dest_range = var.ip_ranges.left
|
|
|
|
next_hop_type = "instance"
|
2021-10-04 01:46:44 -07:00
|
|
|
next_hop = module.gw[var.zones[0]].self_link
|
2020-08-15 01:12:43 -07:00
|
|
|
}
|
|
|
|
to-left-gw-2 = {
|
|
|
|
dest_range = var.ip_ranges.left
|
|
|
|
next_hop_type = "instance"
|
2021-10-04 01:46:44 -07:00
|
|
|
next_hop = module.gw[var.zones[1]].self_link
|
2020-08-15 01:12:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module "firewall-right" {
|
2022-11-04 05:56:07 -07:00
|
|
|
source = "../../../modules/net-vpc-firewall"
|
|
|
|
project_id = module.project.project_id
|
|
|
|
network = module.vpc-right.name
|
|
|
|
default_rules_config = {
|
|
|
|
admin_ranges = values(var.ip_ranges)
|
|
|
|
ssh_ranges = ["35.235.240.0/20", "35.191.0.0/16", "130.211.0.0/22"]
|
|
|
|
}
|
2020-08-15 01:12:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
module "nat-right" {
|
2022-01-10 06:09:38 -08:00
|
|
|
source = "../../../modules/net-cloudnat"
|
2020-08-15 01:12:43 -07:00
|
|
|
project_id = module.project.project_id
|
|
|
|
region = var.region
|
2022-11-23 02:09:00 -08:00
|
|
|
name = "${var.prefix}-right"
|
2020-08-15 01:12:43 -07:00
|
|
|
router_network = module.vpc-right.name
|
|
|
|
}
|