2022-01-19 05:17:20 -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
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
# tfdoc:file:description Networking folder and hierarchical policy.
|
|
|
|
|
|
|
|
locals {
|
|
|
|
# define the structures used for BGP peers in the VPN resources
|
|
|
|
bgp_peer_options = {
|
|
|
|
for k, v in var.vpn_spoke_configs :
|
2022-01-24 05:40:49 -08:00
|
|
|
k => v.adv == null ? null : {
|
2022-01-19 05:17:20 -08:00
|
|
|
advertise_groups = []
|
|
|
|
advertise_ip_ranges = {
|
2022-01-24 05:40:49 -08:00
|
|
|
for adv in(v.adv == null ? [] : v.adv.custom) :
|
2022-01-19 05:17:20 -08:00
|
|
|
var.custom_adv[adv] => adv
|
|
|
|
}
|
2022-01-24 05:40:49 -08:00
|
|
|
advertise_mode = try(v.adv.default, false) ? "DEFAULT" : "CUSTOM"
|
2022-01-19 05:17:20 -08:00
|
|
|
route_priority = null
|
|
|
|
}
|
|
|
|
}
|
2022-01-24 05:40:49 -08:00
|
|
|
l7ilb_subnets = {
|
|
|
|
for env, v in var.l7ilb_subnets : env => [
|
|
|
|
for s in v : merge(s, {
|
|
|
|
active = true
|
|
|
|
name = "${env}-l7ilb-${s.region}"
|
2022-01-19 05:17:20 -08:00
|
|
|
})]
|
|
|
|
}
|
|
|
|
region_trigram = {
|
|
|
|
europe-west1 = "ew1"
|
|
|
|
europe-west3 = "ew3"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module "folder" {
|
|
|
|
source = "../../../modules/folder"
|
|
|
|
parent = "organizations/${var.organization.id}"
|
|
|
|
name = "Networking"
|
|
|
|
folder_create = var.folder_id == null
|
|
|
|
id = var.folder_id
|
|
|
|
firewall_policy_factory = {
|
|
|
|
cidr_file = "${var.data_dir}/cidrs.yaml"
|
|
|
|
policy_name = null
|
|
|
|
rules_file = "${var.data_dir}/hierarchical-policy-rules.yaml"
|
|
|
|
}
|
|
|
|
firewall_policy_association = {
|
|
|
|
factory-policy = "factory"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|