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

Dns refactory #130

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7f3dbcf
DNS Refactory for hub-and-spoke
renato-rudnicki Nov 1, 2024
20fd603
remove dns-hub.tf
renato-rudnicki Nov 4, 2024
5ee619b
remove dns_hub code
renato-rudnicki Nov 6, 2024
7f6644d
fix lint and module names
renato-rudnicki Nov 6, 2024
b6e1cf8
change conditional for advertised_ip_ranges
renato-rudnicki Nov 6, 2024
b6810c7
Merge branch 'master' into dns-refactory
renato-rudnicki Nov 7, 2024
573bdf4
removing dns_hub_project_id references
renato-rudnicki Nov 12, 2024
62274d7
fix project for vpc_dns_hub
renato-rudnicki Nov 14, 2024
e39a508
fix base_shared project value
renato-rudnicki Nov 14, 2024
8306009
fix shared network
renato-rudnicki Nov 21, 2024
f7c4d14
fix advertised_ip_ranges
renato-rudnicki Nov 27, 2024
04dbfcc
change advertised_ip_ranges to local advertised_ip
renato-rudnicki Dec 6, 2024
b27c513
remove target_name_server_addresses from dev/prod/nonprod
renato-rudnicki Dec 6, 2024
770b957
remove dns-hub from dual_shared_vpc
renato-rudnicki Dec 12, 2024
71eda88
DNS Forward for dual-shared-vpc
renato-rudnicki Dec 13, 2024
576a942
dual-shared-vpc-changes
renato-rudnicki Dec 19, 2024
d92c5ce
fix lint
renato-rudnicki Dec 19, 2024
cc17b6a
refactoy DNS Dual-Shared
renato-rudnicki Dec 20, 2024
30000d3
Merge branch 'master' into dns-refactory
renato-rudnicki Dec 26, 2024
e9867b6
remove comments and update code
renato-rudnicki Dec 26, 2024
1557bd0
Changes related to PR review
renato-rudnicki Dec 27, 2024
7b3b67f
Merge branch 'master' into dns-refactory
renato-rudnicki Jan 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 0 additions & 156 deletions 3-networks-hub-and-spoke/envs/shared/dns-hub.tf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
module "dns_hub_interconnect" {
source = "../../modules/dedicated_interconnect"

vpc_name = "net-dns"
vpc_name = "vpc-net-dns"
daniel-cit marked this conversation as resolved.
Show resolved Hide resolved
interconnect_project_id = local.dns_hub_project_id

region1 = local.default_region1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
module "dns_hub_interconnect" {
source = "../../modules/partner_interconnect"

vpc_name = "net-dns"
vpc_name = "vpc-net-dns"
daniel-cit marked this conversation as resolved.
Show resolved Hide resolved
attachment_project_id = local.dns_hub_project_id
preactivate = var.preactivate_partner_interconnect

Expand Down
22 changes: 22 additions & 0 deletions 3-networks-hub-and-spoke/modules/base_shared_vpc/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ module "peering_zone" {
source = "terraform-google-modules/cloud-dns/google"
version = "~> 5.0"

count = local.mode == "spoke" ? 1 : 0

project_id = var.project_id
type = "peering"
name = "dz-${var.environment_code}-shared-base-to-dns-hub"
Expand All @@ -51,3 +53,23 @@ module "peering_zone" {
]
target_network = data.google_compute_network.vpc_dns_hub.self_link
}

/******************************************
DNS Forwarding
*****************************************/
module "dns-forwarding-zone" {
source = "terraform-google-modules/cloud-dns/google"
version = "~> 5.0"

count = var.mode != "spoke" ? 1 : 0

project_id = var.project_id
type = "forwarding"
name = "fz-dns-hub"
domain = var.domain

private_visibility_config_networks = [
module.dns_hub_vpc.network_self_link
]
target_name_server_addresses = data.google_compute_network.vpc_dns_hub.self_link
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing empty line at the end of file

20 changes: 16 additions & 4 deletions 3-networks-hub-and-spoke/modules/base_shared_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ module "region1_router1" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.private_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.private_googleapis_cidr },
{ range = "35.199.192.0/19" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ range = "35.199.192.0/19" } is conditional on the network being the one that will access the dns server in the on-prem infrastructure

]
}
}

Expand All @@ -142,7 +145,10 @@ module "region1_router2" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.private_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.private_googleapis_cidr },
{ range = "35.199.192.0/19" }
]
}
}

Expand All @@ -158,7 +164,10 @@ module "region2_router1" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.private_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.private_googleapis_cidr },
{ range = "35.199.192.0/19" }
]
}
}

Expand All @@ -174,6 +183,9 @@ module "region2_router2" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.private_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.private_googleapis_cidr },
{ range = "35.199.192.0/19" }
]
}
}
22 changes: 22 additions & 0 deletions 3-networks-hub-and-spoke/modules/restricted_shared_vpc/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ module "peering_zone" {
source = "terraform-google-modules/cloud-dns/google"
version = "~> 5.0"

count = var.mode == "spoke" ? 1 : 0

project_id = var.project_id
type = "peering"
name = "dz-${var.environment_code}-shared-restricted-to-dns-hub"
Expand All @@ -51,3 +53,23 @@ module "peering_zone" {
]
target_network = data.google_compute_network.vpc_dns_hub.self_link
}

/******************************************
DNS Forwarding
*****************************************/
module "dns-forwarding-zone" {
source = "terraform-google-modules/cloud-dns/google"
version = "~> 5.0"

count = var.mode != "spoke" ? 1 : 0

project_id = var.project_id
type = "forwarding"
name = "fz-dns-hub"
domain = var.domain

private_visibility_config_networks = [
module.dns_hub_vpc.network_self_link
]
target_name_server_addresses = data.google_compute_network.vpc_dns_hub.self_link
}
20 changes: 16 additions & 4 deletions 3-networks-hub-and-spoke/modules/restricted_shared_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ module "region1_router1" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.restricted_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.restricted_googleapis_cidr },
{ range = "35.199.192.0/19" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ range = "35.199.192.0/19" } is conditional on the network being the one that will access the dns server in the on-prem infrastructure

]
}
}

Expand All @@ -146,7 +149,10 @@ module "region1_router2" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.restricted_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.restricted_googleapis_cidr },
{ range = "35.199.192.0/19" }
]
}
}

Expand All @@ -162,7 +168,10 @@ module "region2_router1" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.restricted_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.restricted_googleapis_cidr },
{ range = "35.199.192.0/19" }
]
}
}

Expand All @@ -178,6 +187,9 @@ module "region2_router2" {
bgp = {
asn = var.bgp_asn_subnet
advertised_groups = ["ALL_SUBNETS"]
advertised_ip_ranges = [{ range = local.restricted_googleapis_cidr }]
advertised_ip_ranges = [
{ range = local.restricted_googleapis_cidr },
{ range = "35.199.192.0/19" }
]
}
}