Skip to content

Commit f87ed16

Browse files
authored
fix: 3-networks inconsistencies and typos (#304)
1 parent 1256328 commit f87ed16

File tree

10 files changed

+32
-30
lines changed

10 files changed

+32
-30
lines changed

3-networks/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 3-networks
22

3-
The purpose of this step is to :
3+
The purpose of this step is to:
44

55
- Setup the global [DNS Hub](https://cloud.google.com/blog/products/networking/cloud-forwarding-peering-and-zones).
66
- Setup base and restricted shared VPCs with default DNS, NAT (optional), Private Service networking, VPC service controls, onprem dedicated interconnect and baseline firewall rules for each environment.
@@ -35,7 +35,7 @@ If you are not able to use dedicated interconnect, you can also use an HA VPN to
3535
### Setup to run via Cloud Build
3636

3737
1. Clone repo `gcloud source repos clone gcp-networks --project=YOUR_CLOUD_BUILD_PROJECT_ID`
38-
1. Change freshly cloned repo and change to non master branch `git checkout -b plan`
38+
1. Change to the freshly cloned repo and change to non-master branch `git checkout -b plan`
3939
1. Copy contents of foundation to new repo `cp -RT ../terraform-example-foundation/3-networks/ .` (modify accordingly based on your current directory).
4040
1. Copy cloud build configuration files for terraform `cp ../terraform-example-foundation/build/cloudbuild-tf-* . ` (modify accordingly based on your current directory)
4141
1. Copy terraform wrapper script `cp ../terraform-example-foundation/build/tf-wrapper.sh . ` to the root of your new repository (modify accordingly based on your current directory).
@@ -55,7 +55,7 @@ If you are not able to use dedicated interconnect, you can also use an HA VPN to
5555
1. Review the plan output in your cloud build project https://console.cloud.google.com/cloud-build/builds?project=YOUR_CLOUD_BUILD_PROJECT_ID
5656
1. Merge changes to production with `git checkout -b production` and `git push origin production`
5757
1. Review the apply output in your cloud build project https://console.cloud.google.com/cloud-build/builds?project=YOUR_CLOUD_BUILD_PROJECT_ID
58-
1. After production has been applied apply development and non-production
58+
1. After production has been applied, apply development and non-production
5959
1. Merge changes to development with `git checkout -b development` and `git push origin development`
6060
1. Review the apply output in your cloud build project https://console.cloud.google.com/cloud-build/builds?project=YOUR_CLOUD_BUILD_PROJECT_ID
6161
1. Merge changes to non-production with `git checkout -b non-production` and `git push origin non-production`
@@ -90,7 +90,7 @@ If you are not able to use dedicated interconnect, you can also use an HA VPN to
9090
1. Review the plan output in your Master's web UI.
9191
1. Merge changes to production branch with `git checkout -b production` and `git push origin production`
9292
1. Review the apply output in your Master's web UI (You might want to use the option to "Scan Multibranch Pipeline Now" in your Jenkins Master UI).
93-
1. After production has been applied apply development and non-production
93+
1. After production has been applied, apply development and non-production
9494
1. Merge changes to development with `git checkout -b development` and `git push origin development`
9595
1. Review the apply output in your Master's web UI (You might want to use the option to "Scan Multibranch Pipeline Now" in your Jenkins Master UI).
9696
1. Merge changes to non-production with `git checkout -b non-production` and `git push origin non-production`
@@ -108,7 +108,7 @@ If you are not able to use dedicated interconnect, you can also use an HA VPN to
108108
1. Rename access_context.auto.example.tfvars to access_context.auto.tfvars and update the file with the access_context_manager_policy_id.
109109
1. Update backend.tf with your bucket from bootstrap. You can run
110110
```for i in `find -name 'backend.tf'`; do sed -i 's/UPDATE_ME/<YOUR-BUCKET-NAME>/' $i; done```.
111-
You can run `terraform output gcs_bucket_tfstate` in the 0-bootstap folder to obtain the bucket name.
111+
You can run `terraform output gcs_bucket_tfstate` in the 0-bootstrap folder to obtain the bucket name.
112112
113113
We will now deploy each of our environments(development/production/non-production) using this script.
114114
When using Cloud Build or Jenkins as your CI/CD tool each environment corresponds to a branch in the repository for 3-networks step

3-networks/envs/development/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The purpose of this step is to set up base and restricted shared VPCs with defau
2121
| dns\_enable\_inbound\_forwarding | Toggle inbound query forwarding for VPC DNS. | `bool` | `true` | no |
2222
| dns\_enable\_logging | Toggle DNS logging for VPC DNS. | `bool` | `true` | no |
2323
| domain | The DNS name of peering managed zone, for instance 'example.com.' | `string` | n/a | yes |
24-
| firewall\_enable\_logging | Toggle firewall logginglogging for VPC Firewalls. | `bool` | `true` | no |
24+
| firewall\_enable\_logging | Toggle firewall logging for VPC Firewalls. | `bool` | `true` | no |
2525
| nat\_bgp\_asn | BGP ASN for first NAT cloud routes. | `number` | `64514` | no |
2626
| nat\_enabled | Toggle creation of NAT cloud router. | `bool` | `false` | no |
2727
| nat\_num\_addresses | Number of external IPs to reserve for Cloud NAT. | `number` | `2` | no |
@@ -30,7 +30,7 @@ The purpose of this step is to set up base and restricted shared VPCs with defau
3030
| optional\_fw\_rules\_enabled | Toggle creation of optional firewall rules: IAP SSH, IAP RDP and Internal & Global load balancing health check and load balancing IP ranges. | `bool` | `false` | no |
3131
| org\_id | Organization ID | `string` | n/a | yes |
3232
| parent\_folder | Optional - if using a folder for testing. | `string` | `""` | no |
33-
| subnetworks\_enable\_logging | Toggle subnetworks flow logging for VPC Subnetwoks. | `bool` | `true` | no |
33+
| subnetworks\_enable\_logging | Toggle subnetworks flow logging for VPC Subnetworks. | `bool` | `true` | no |
3434
| terraform\_service\_account | Service account email of the account to impersonate to run Terraform. | `string` | n/a | yes |
3535
| windows\_activation\_enabled | Enable Windows license activation for Windows workloads. | `bool` | `false` | no |
3636

3-networks/envs/development/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
env = "development"
2020
restricted_project_id = data.google_projects.restricted_host_project.projects[0].project_id
2121
restricted_project_number = data.google_project.restricted_host_project.number
22-
base_project_id = data.google_projects.base_project.projects[0].project_id
22+
base_project_id = data.google_projects.base_host_project.projects[0].project_id
2323
parent_id = var.parent_folder != "" ? "folders/${var.parent_folder}" : "organizations/${var.org_id}"
2424
}
2525

@@ -40,7 +40,7 @@ data "google_project" "restricted_host_project" {
4040
project_id = data.google_projects.restricted_host_project.projects[0].project_id
4141
}
4242

43-
data "google_projects" "base_project" {
43+
data "google_projects" "base_host_project" {
4444
filter = "parent.id:${split("/", data.google_active_folder.env.name)[1]} labels.application_name=base-shared-vpc-host labels.environment=${local.env} lifecycleState=ACTIVE"
4545
}
4646

@@ -149,9 +149,10 @@ module "base_shared_vpc" {
149149
}
150150
]
151151
secondary_ranges = {
152-
"sb-${local.environment_code}-shared-base-${var.default_region1}" = [{
153-
range_name = "rn-${local.environment_code}-shared-base-${var.default_region1}-gke-pod"
154-
ip_cidr_range = "192.168.96.0/19"
152+
"sb-${local.environment_code}-shared-base-${var.default_region1}" = [
153+
{
154+
range_name = "rn-${local.environment_code}-shared-base-${var.default_region1}-gke-pod"
155+
ip_cidr_range = "192.168.96.0/19"
155156
},
156157
{
157158
range_name = "rn-${local.environment_code}-shared-base-${var.default_region1}-gke-svc"

3-networks/envs/development/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ variable "dns_enable_logging" {
5252

5353
variable "subnetworks_enable_logging" {
5454
type = bool
55-
description = "Toggle subnetworks flow logging for VPC Subnetwoks."
55+
description = "Toggle subnetworks flow logging for VPC Subnetworks."
5656
default = true
5757
}
5858

5959
variable "firewall_enable_logging" {
6060
type = bool
61-
description = "Toggle firewall logginglogging for VPC Firewalls."
61+
description = "Toggle firewall logging for VPC Firewalls."
6262
default = true
6363
}
6464

3-networks/envs/non-production/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The purpose of this step is to set up base and restricted shared VPCs with defau
2121
| dns\_enable\_inbound\_forwarding | Toggle inbound query forwarding for VPC DNS. | `bool` | `true` | no |
2222
| dns\_enable\_logging | Toggle DNS logging for VPC DNS. | `bool` | `true` | no |
2323
| domain | The DNS name of peering managed zone, for instance 'example.com.' | `string` | n/a | yes |
24-
| firewall\_enable\_logging | Toggle firewall logginglogging for VPC Firewalls. | `bool` | `true` | no |
24+
| firewall\_enable\_logging | Toggle firewall logging for VPC Firewalls. | `bool` | `true` | no |
2525
| nat\_bgp\_asn | BGP ASN for first NAT cloud routes. | `number` | `64514` | no |
2626
| nat\_enabled | Toggle creation of NAT cloud router. | `bool` | `false` | no |
2727
| nat\_num\_addresses | Number of external IPs to reserve for Cloud NAT. | `number` | `2` | no |
@@ -30,7 +30,7 @@ The purpose of this step is to set up base and restricted shared VPCs with defau
3030
| optional\_fw\_rules\_enabled | Toggle creation of optional firewall rules: IAP SSH, IAP RDP and Internal & Global load balancing health check and load balancing IP ranges. | `bool` | `false` | no |
3131
| org\_id | Organization ID | `string` | n/a | yes |
3232
| parent\_folder | Optional - if using a folder for testing. | `string` | `""` | no |
33-
| subnetworks\_enable\_logging | Toggle subnetworks flow logging for VPC Subnetwoks. | `bool` | `true` | no |
33+
| subnetworks\_enable\_logging | Toggle subnetworks flow logging for VPC Subnetworks. | `bool` | `true` | no |
3434
| terraform\_service\_account | Service account email of the account to impersonate to run Terraform. | `string` | n/a | yes |
3535
| windows\_activation\_enabled | Enable Windows license activation for Windows workloads. | `bool` | `false` | no |
3636

3-networks/envs/non-production/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,21 @@ module "restricted_shared_vpc" {
9292
}
9393
]
9494
secondary_ranges = {
95-
"sb-${local.environment_code}-shared-restricted-${var.default_region2}" = [
95+
"sb-${local.environment_code}-shared-restricted-${var.default_region1}" = [
9696
{
97-
range_name = "rn-${local.environment_code}-shared-restricted-${var.default_region2}-gke-pod"
97+
range_name = "rn-${local.environment_code}-shared-restricted-${var.default_region1}-gke-pod"
9898
ip_cidr_range = "192.168.0.0/19"
9999
},
100100
{
101-
range_name = "rn-${local.environment_code}-shared-restricted-${var.default_region2}-gke-svc"
101+
range_name = "rn-${local.environment_code}-shared-restricted-${var.default_region1}-gke-svc"
102102
ip_cidr_range = "192.168.32.0/23"
103103
}
104104
]
105105
}
106106
}
107107

108108
/******************************************
109-
Private shared VPC
109+
Base shared VPC
110110
*****************************************/
111111

112112
module "base_shared_vpc" {

3-networks/envs/non-production/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ variable "dns_enable_logging" {
5252

5353
variable "subnetworks_enable_logging" {
5454
type = bool
55-
description = "Toggle subnetworks flow logging for VPC Subnetwoks."
55+
description = "Toggle subnetworks flow logging for VPC Subnetworks."
5656
default = true
5757
}
5858

5959
variable "firewall_enable_logging" {
6060
type = bool
61-
description = "Toggle firewall logginglogging for VPC Firewalls."
61+
description = "Toggle firewall logging for VPC Firewalls."
6262
default = true
6363
}
6464

3-networks/envs/production/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The purpose of this step is to set up base and restricted shared VPCs with defau
2121
| dns\_enable\_inbound\_forwarding | Toggle inbound query forwarding for VPC DNS. | `bool` | `true` | no |
2222
| dns\_enable\_logging | Toggle DNS logging for VPC DNS. | `bool` | `true` | no |
2323
| domain | The DNS name of peering managed zone, for instance 'example.com.' | `string` | n/a | yes |
24-
| firewall\_enable\_logging | Toggle firewall logginglogging for VPC Firewalls. | `bool` | `true` | no |
24+
| firewall\_enable\_logging | Toggle firewall logging for VPC Firewalls. | `bool` | `true` | no |
2525
| nat\_bgp\_asn | BGP ASN for first NAT cloud routes. | `number` | `64514` | no |
2626
| nat\_enabled | Toggle creation of NAT cloud router. | `bool` | `false` | no |
2727
| nat\_num\_addresses | Number of external IPs to reserve for Cloud NAT. | `number` | `2` | no |
@@ -30,7 +30,7 @@ The purpose of this step is to set up base and restricted shared VPCs with defau
3030
| optional\_fw\_rules\_enabled | Toggle creation of optional firewall rules: IAP SSH, IAP RDP and Internal & Global load balancing health check and load balancing IP ranges. | `bool` | `false` | no |
3131
| org\_id | Organization ID | `string` | n/a | yes |
3232
| parent\_folder | Optional - if using a folder for testing. | `string` | `""` | no |
33-
| subnetworks\_enable\_logging | Toggle subnetworks flow logging for VPC Subnetwoks. | `bool` | `true` | no |
33+
| subnetworks\_enable\_logging | Toggle subnetworks flow logging for VPC Subnetworks. | `bool` | `true` | no |
3434
| terraform\_service\_account | Service account email of the account to impersonate to run Terraform. | `string` | n/a | yes |
3535
| windows\_activation\_enabled | Enable Windows license activation for Windows workloads. | `bool` | `false` | no |
3636

3-networks/envs/production/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ module "restricted_shared_vpc" {
105105
}
106106

107107
/******************************************
108-
Private shared VPC
108+
Base shared VPC
109109
*****************************************/
110110

111111
module "base_shared_vpc" {
@@ -149,9 +149,10 @@ module "base_shared_vpc" {
149149
}
150150
]
151151
secondary_ranges = {
152-
"sb-${local.environment_code}-shared-base-${var.default_region1}" = [{
153-
range_name = "rn-${local.environment_code}-shared-base-${var.default_region1}-gke-pod"
154-
ip_cidr_range = "192.168.96.0/19"
152+
"sb-${local.environment_code}-shared-base-${var.default_region1}" = [
153+
{
154+
range_name = "rn-${local.environment_code}-shared-base-${var.default_region1}-gke-pod"
155+
ip_cidr_range = "192.168.96.0/19"
155156
},
156157
{
157158
range_name = "rn-${local.environment_code}-shared-base-${var.default_region1}-gke-svc"

3-networks/envs/production/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ variable "dns_enable_logging" {
5252

5353
variable "subnetworks_enable_logging" {
5454
type = bool
55-
description = "Toggle subnetworks flow logging for VPC Subnetwoks."
55+
description = "Toggle subnetworks flow logging for VPC Subnetworks."
5656
default = true
5757
}
5858

5959
variable "firewall_enable_logging" {
6060
type = bool
61-
description = "Toggle firewall logginglogging for VPC Firewalls."
61+
description = "Toggle firewall logging for VPC Firewalls."
6262
default = true
6363
}
6464
variable "dns_enable_inbound_forwarding" {

0 commit comments

Comments
 (0)