2023-04-04 11:41:04 -07:00
|
|
|
/**
|
2024-01-31 04:44:51 -08:00
|
|
|
* Copyright 2024 Google LLC
|
2023-04-04 11:41:04 -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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
# tfdoc:file:description Landing DNS zones and peerings setup.
|
|
|
|
|
|
|
|
# forwarding to on-prem DNS resolvers
|
|
|
|
|
2023-05-03 22:38:40 -07:00
|
|
|
moved {
|
|
|
|
from = module.onprem-example-dns-forwarding
|
|
|
|
to = module.landing-dns-fwd-onprem-example
|
|
|
|
}
|
|
|
|
|
|
|
|
module "landing-dns-fwd-onprem-example" {
|
2023-04-04 11:41:04 -07:00
|
|
|
source = "../../../modules/dns"
|
2024-01-31 04:44:51 -08:00
|
|
|
count = length(var.dns.resolvers) > 0 ? 1 : 0
|
2023-04-04 11:41:04 -07:00
|
|
|
project_id = module.landing-project.project_id
|
|
|
|
name = "example-com"
|
2023-07-18 10:32:57 -07:00
|
|
|
zone_config = {
|
|
|
|
domain = "onprem.example.com."
|
|
|
|
forwarding = {
|
|
|
|
client_networks = [
|
|
|
|
module.landing-untrusted-vpc.self_link,
|
|
|
|
module.landing-trusted-vpc.self_link
|
|
|
|
]
|
2024-01-31 04:44:51 -08:00
|
|
|
forwarders = { for ip in var.dns.resolvers : ip => null }
|
2023-07-18 10:32:57 -07:00
|
|
|
}
|
|
|
|
}
|
2023-04-04 11:41:04 -07:00
|
|
|
}
|
|
|
|
|
2023-05-03 22:38:40 -07:00
|
|
|
moved {
|
|
|
|
from = module.reverse-10-dns-forwarding
|
|
|
|
to = module.landing-dns-fwd-onprem-rev-10
|
|
|
|
}
|
|
|
|
|
|
|
|
module "landing-dns-fwd-onprem-rev-10" {
|
2023-04-04 11:41:04 -07:00
|
|
|
source = "../../../modules/dns"
|
2024-01-31 04:44:51 -08:00
|
|
|
count = length(var.dns.resolvers) > 0 ? 1 : 0
|
2023-04-04 11:41:04 -07:00
|
|
|
project_id = module.landing-project.project_id
|
|
|
|
name = "root-reverse-10"
|
2023-07-18 10:32:57 -07:00
|
|
|
zone_config = {
|
|
|
|
domain = "10.in-addr.arpa."
|
|
|
|
forwarding = {
|
|
|
|
client_networks = [
|
|
|
|
module.landing-untrusted-vpc.self_link,
|
|
|
|
module.landing-trusted-vpc.self_link
|
|
|
|
]
|
2024-01-31 04:44:51 -08:00
|
|
|
forwarders = { for ip in var.dns.resolvers : ip => null }
|
2023-07-18 10:32:57 -07:00
|
|
|
}
|
|
|
|
}
|
2023-04-04 11:41:04 -07:00
|
|
|
}
|
|
|
|
|
2023-05-03 22:38:40 -07:00
|
|
|
moved {
|
|
|
|
from = module.gcp-example-dns-private-zone
|
|
|
|
to = module.landing-dns-priv-gcp
|
|
|
|
}
|
|
|
|
|
|
|
|
module "landing-dns-priv-gcp" {
|
2023-04-04 11:41:04 -07:00
|
|
|
source = "../../../modules/dns"
|
|
|
|
project_id = module.landing-project.project_id
|
|
|
|
name = "gcp-example-com"
|
2023-07-18 10:32:57 -07:00
|
|
|
zone_config = {
|
|
|
|
domain = "gcp.example.com."
|
|
|
|
private = {
|
|
|
|
client_networks = [
|
|
|
|
module.landing-untrusted-vpc.self_link,
|
|
|
|
module.landing-trusted-vpc.self_link
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2023-04-04 11:41:04 -07:00
|
|
|
recordsets = {
|
|
|
|
"A localhost" = { records = ["127.0.0.1"] }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Google APIs
|
|
|
|
|
2023-05-03 22:38:40 -07:00
|
|
|
module "landing-dns-policy-googleapis" {
|
|
|
|
source = "../../../modules/dns-response-policy"
|
2023-04-04 11:41:04 -07:00
|
|
|
project_id = module.landing-project.project_id
|
2023-05-03 22:38:40 -07:00
|
|
|
name = "googleapis"
|
2024-02-26 02:16:52 -08:00
|
|
|
factories_config = {
|
|
|
|
rules = var.factories_config.dns_policy_rules_file
|
|
|
|
}
|
2023-05-03 22:38:40 -07:00
|
|
|
networks = {
|
|
|
|
landing-trusted = module.landing-trusted-vpc.self_link
|
|
|
|
landing-untrusted = module.landing-untrusted-vpc.self_link
|
2023-04-04 11:41:04 -07:00
|
|
|
}
|
|
|
|
}
|