2022-01-13 23:45:14 -08:00
|
|
|
# Copyright 2022 Google LLC
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# https://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" {
|
2022-01-14 01:28:19 -08:00
|
|
|
source = "../../../modules/net-vpc"
|
2023-06-06 00:06:58 -07:00
|
|
|
count = var.network_config.host_project == null ? 1 : 0
|
2022-01-14 04:55:47 -08:00
|
|
|
project_id = module.project.project_id
|
|
|
|
name = "${var.prefix}-vpc"
|
2022-01-13 23:45:14 -08:00
|
|
|
subnets = [
|
|
|
|
{
|
2022-10-14 02:02:33 -07:00
|
|
|
ip_cidr_range = var.vpc_subnet_range
|
|
|
|
name = "subnet"
|
|
|
|
region = var.region
|
2022-01-13 23:45:14 -08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
module "vpc-firewall" {
|
2022-11-04 05:56:07 -07:00
|
|
|
source = "../../../modules/net-vpc-firewall"
|
2023-06-06 00:06:58 -07:00
|
|
|
count = var.network_config.host_project == null ? 1 : 0
|
2022-11-04 05:56:07 -07:00
|
|
|
project_id = module.project.project_id
|
|
|
|
network = module.vpc[0].name
|
|
|
|
default_rules_config = {
|
|
|
|
admin_ranges = [var.vpc_subnet_range]
|
|
|
|
}
|
2022-01-13 23:45:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
module "nat" {
|
2022-01-14 01:28:19 -08:00
|
|
|
source = "../../../modules/net-cloudnat"
|
2023-06-06 00:06:58 -07:00
|
|
|
count = var.network_config.host_project == null ? 1 : 0
|
2022-01-14 04:55:47 -08:00
|
|
|
project_id = module.project.project_id
|
2022-01-13 23:45:14 -08:00
|
|
|
region = var.region
|
2022-01-14 04:55:47 -08:00
|
|
|
name = "${var.prefix}-default"
|
2022-03-29 06:12:37 -07:00
|
|
|
router_network = module.vpc[0].name
|
2022-01-13 23:45:14 -08:00
|
|
|
}
|