Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DNS query logging to FAST net stages #2033

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 deletions fast/stages/2-networking-a-peering/README.md

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion fast/stages/2-networking-a-peering/dns-dev.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,3 +75,15 @@ module "dev-dns-peer-landing-rev-10" {
}
}
}

# DNS policy to enable query logging

resource "google_dns_policy" "dev-dns-logging-policy" {
name = "logging-policy"
count = var.dns.enable_logging ? 1 : 0
project = module.dev-spoke-project.project_id
enable_logging = true
networks {
network_url = module.dev-spoke-vpc.id
}
}
20 changes: 17 additions & 3 deletions fast/stages/2-networking-a-peering/dns-landing.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,13 +25,14 @@ moved {

module "landing-dns-fwd-onprem-example" {
source = "../../../modules/dns"
count = length(var.dns.resolvers) > 0 ? 1 : 0
project_id = module.landing-project.project_id
name = "example-com"
zone_config = {
domain = "onprem.example.com."
forwarding = {
client_networks = [module.landing-vpc.self_link]
forwarders = { for ip in var.dns.onprem : ip => null }
forwarders = { for ip in var.dns.resolvers : ip => null }
}
}
}
Expand All @@ -43,13 +44,14 @@ moved {

module "landing-dns-fwd-onprem-rev-10" {
source = "../../../modules/dns"
count = length(var.dns.resolvers) > 0 ? 1 : 0
project_id = module.landing-project.project_id
name = "root-reverse-10"
zone_config = {
domain = "10.in-addr.arpa."
forwarding = {
client_networks = [module.landing-vpc.self_link]
forwarders = { for ip in var.dns.onprem : ip => null }
forwarders = { for ip in var.dns.resolvers : ip => null }
}
}
}
Expand Down Expand Up @@ -85,3 +87,15 @@ module "landing-dns-policy-googleapis" {
}
rules_file = var.factories_config.dns_policy_rules_file
}

# DNS policy to enable query logging

resource "google_dns_policy" "landing-dns-logging-policy" {
name = "logging-policy"
count = var.dns.enable_logging ? 1 : 0
project = module.landing-project.project_id
enable_logging = true
networks {
network_url = module.landing-vpc.id
}
}
14 changes: 13 additions & 1 deletion fast/stages/2-networking-a-peering/dns-prod.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,3 +75,15 @@ module "prod-dns-peer-landing-rev-10" {
}
}
}

# DNS policy to enable query logging

resource "google_dns_policy" "prod-dns-logging-policy" {
name = "logging-policy"
count = var.dns.enable_logging ? 1 : 0
project = module.prod-spoke-project.project_id
enable_logging = true
networks {
network_url = module.prod-spoke-vpc.id
}
}
14 changes: 8 additions & 6 deletions fast/stages/2-networking-a-peering/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,11 +70,13 @@ variable "custom_roles" {
}

variable "dns" {
description = "Onprem DNS resolvers."
type = map(list(string))
default = {
onprem = ["10.0.200.3"]
}
description = "DNS configuration."
type = object({
enable_logging = optional(bool, true)
resolvers = optional(list(string), [])
})
default = {}
nullable = false
}

variable "factories_config" {
Expand Down
28 changes: 14 additions & 14 deletions fast/stages/2-networking-b-vpn/README.md

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion fast/stages/2-networking-b-vpn/dns-dev.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,3 +75,15 @@ module "dev-dns-peer-landing-rev-10" {
}
}
}

# DNS policy to enable query logging

resource "google_dns_policy" "dev-dns-logging-policy" {
name = "logging-policy"
count = var.dns.enable_logging ? 1 : 0
project = module.dev-spoke-project.project_id
enable_logging = true
networks {
network_url = module.dev-spoke-vpc.id
}
}
20 changes: 17 additions & 3 deletions fast/stages/2-networking-b-vpn/dns-landing.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,13 +25,14 @@ moved {

module "landing-dns-fwd-onprem-example" {
source = "../../../modules/dns"
count = length(var.dns.resolvers) > 0 ? 1 : 0
project_id = module.landing-project.project_id
name = "example-com"
zone_config = {
domain = "onprem.example.com."
forwarding = {
client_networks = [module.landing-vpc.self_link]
forwarders = { for ip in var.dns.onprem : ip => null }
forwarders = { for ip in var.dns.resolvers : ip => null }
}
}
}
Expand All @@ -43,13 +44,14 @@ moved {

module "landing-dns-fwd-onprem-rev-10" {
source = "../../../modules/dns"
count = length(var.dns.resolvers) > 0 ? 1 : 0
project_id = module.landing-project.project_id
name = "root-reverse-10"
zone_config = {
domain = "10.in-addr.arpa."
forwarding = {
client_networks = [module.landing-vpc.self_link]
forwarders = { for ip in var.dns.onprem : ip => null }
forwarders = { for ip in var.dns.resolvers : ip => null }
}
}
}
Expand Down Expand Up @@ -85,3 +87,15 @@ module "landing-dns-policy-googleapis" {
}
rules_file = var.factories_config.dns_policy_rules_file
}

# DNS policy to enable query logging

resource "google_dns_policy" "landing-dns-logging-policy" {
name = "logging-policy"
count = var.dns.enable_logging ? 1 : 0
project = module.landing-project.project_id
enable_logging = true
networks {
network_url = module.landing-vpc.id
}
}
14 changes: 13 additions & 1 deletion fast/stages/2-networking-b-vpn/dns-prod.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,3 +75,15 @@ module "prod-dns-peer-landing-rev-10" {
}
}
}

# DNS policy to enable query logging

resource "google_dns_policy" "prod-dns-logging-policy" {
name = "logging-policy"
count = var.dns.enable_logging ? 1 : 0
project = module.prod-spoke-project.project_id
enable_logging = true
networks {
network_url = module.prod-spoke-vpc.id
}
}
14 changes: 8 additions & 6 deletions fast/stages/2-networking-b-vpn/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,11 +70,13 @@ variable "custom_roles" {
}

variable "dns" {
description = "Onprem DNS resolvers."
type = map(list(string))
default = {
onprem = ["10.0.200.3"]
}
description = "DNS configuration."
type = object({
enable_logging = optional(bool, true)
resolvers = optional(list(string), [])
})
default = {}
nullable = false
}

variable "factories_config" {
Expand Down