diff --git a/0-bootstrap/terraform.example.tfvars b/0-bootstrap/terraform.example.tfvars
index 7e1b09cc7..ffe79e091 100644
--- a/0-bootstrap/terraform.example.tfvars
+++ b/0-bootstrap/terraform.example.tfvars
@@ -56,7 +56,7 @@ default_region = "us-central1"
# gcp_audit_viewer = "gcp_audit_viewer_local_test@example.com"
# }
# }
-#
+
/* ----------------------------------------
diff --git a/3-networks-dual-svpc/envs/development/main.tf b/3-networks-dual-svpc/envs/development/main.tf
index f0fe29f0a..bf158dc36 100644
--- a/3-networks-dual-svpc/envs/development/main.tf
+++ b/3-networks-dual-svpc/envs/development/main.tf
@@ -22,40 +22,48 @@ locals {
/*
* Base network ranges
*/
- base_private_service_cidr = "10.16.64.0/21"
+ base_private_service_cidr = "10.16.8.0/21"
base_subnet_primary_ranges = {
- (local.default_region1) = "10.0.64.0/21"
- (local.default_region2) = "10.1.64.0/21"
+ (local.default_region1) = "10.0.64.0/18"
+ (local.default_region2) = "10.1.64.0/18"
+ }
+ base_subnet_proxy_ranges = {
+ (local.default_region1) = "10.18.2.0/23"
+ (local.default_region2) = "10.19.2.0/23"
}
base_subnet_secondary_ranges = {
(local.default_region1) = [
{
range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-pod"
- ip_cidr_range = "100.64.64.0/21"
+ ip_cidr_range = "100.64.64.0/18"
},
{
range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-svc"
- ip_cidr_range = "100.64.72.0/21"
+ ip_cidr_range = "100.65.64.0/18"
}
]
}
/*
* Restricted network ranges
*/
- restricted_private_service_cidr = "10.24.64.0/21"
+ restricted_private_service_cidr = "10.16.40.0/21"
restricted_subnet_primary_ranges = {
- (local.default_region1) = "10.8.64.0/21"
- (local.default_region2) = "10.9.64.0/21"
+ (local.default_region1) = "10.8.64.0/18"
+ (local.default_region2) = "10.9.64.0/18"
+ }
+ restricted_subnet_proxy_ranges = {
+ (local.default_region1) = "10.26.2.0/23"
+ (local.default_region2) = "10.27.2.0/23"
}
restricted_subnet_secondary_ranges = {
(local.default_region1) = [
{
range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-pod"
- ip_cidr_range = "100.72.64.0/21"
+ ip_cidr_range = "100.72.64.0/18"
},
{
range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-svc"
- ip_cidr_range = "100.72.72.0/21"
+ ip_cidr_range = "100.73.64.0/18"
}
]
}
@@ -76,13 +84,14 @@ module "base_env" {
enable_partner_interconnect = false
base_private_service_cidr = local.base_private_service_cidr
base_subnet_primary_ranges = local.base_subnet_primary_ranges
+ base_subnet_proxy_ranges = local.base_subnet_proxy_ranges
base_subnet_secondary_ranges = local.base_subnet_secondary_ranges
- base_private_service_connect_ip = "10.2.64.5"
+ base_private_service_connect_ip = "10.17.0.2"
restricted_private_service_cidr = local.restricted_private_service_cidr
restricted_subnet_primary_ranges = local.restricted_subnet_primary_ranges
+ restricted_subnet_proxy_ranges = local.restricted_subnet_proxy_ranges
restricted_subnet_secondary_ranges = local.restricted_subnet_secondary_ranges
- restricted_private_service_connect_ip = "10.10.64.5"
+ restricted_private_service_connect_ip = "10.17.0.6"
remote_state_bucket = var.remote_state_bucket
tfc_org_name = var.tfc_org_name
-
}
diff --git a/3-networks-dual-svpc/envs/non-production/main.tf b/3-networks-dual-svpc/envs/non-production/main.tf
index 1c3c02d53..422db1ec2 100644
--- a/3-networks-dual-svpc/envs/non-production/main.tf
+++ b/3-networks-dual-svpc/envs/non-production/main.tf
@@ -22,40 +22,48 @@ locals {
/*
* Base network ranges
*/
- base_private_service_cidr = "10.16.128.0/21"
+ base_private_service_cidr = "10.16.16.0/21"
base_subnet_primary_ranges = {
- (local.default_region1) = "10.0.128.0/21"
- (local.default_region2) = "10.1.128.0/21"
+ (local.default_region1) = "10.0.128.0/18"
+ (local.default_region2) = "10.1.128.0/18"
+ }
+ base_subnet_proxy_ranges = {
+ (local.default_region1) = "10.18.4.0/23"
+ (local.default_region2) = "10.19.4.0/23"
}
base_subnet_secondary_ranges = {
(local.default_region1) = [
{
range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-pod"
- ip_cidr_range = "100.64.128.0/21"
+ ip_cidr_range = "100.64.128.0/18"
},
{
range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-svc"
- ip_cidr_range = "100.64.136.0/21"
+ ip_cidr_range = "100.65.128.0/18"
}
]
}
/*
* Restricted network ranges
*/
- restricted_private_service_cidr = "10.24.128.0/21"
+ restricted_private_service_cidr = "10.16.48.0/21"
restricted_subnet_primary_ranges = {
- (local.default_region1) = "10.8.128.0/21"
- (local.default_region2) = "10.9.128.0/21"
+ (local.default_region1) = "10.8.128.0/18"
+ (local.default_region2) = "10.9.128.0/18"
+ }
+ restricted_subnet_proxy_ranges = {
+ (local.default_region1) = "10.26.4.0/23"
+ (local.default_region2) = "10.27.4.0/23"
}
restricted_subnet_secondary_ranges = {
(local.default_region1) = [
{
range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-pod"
- ip_cidr_range = "100.72.128.0/21"
+ ip_cidr_range = "100.72.128.0/18"
},
{
range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-svc"
- ip_cidr_range = "100.72.136.0/21"
+ ip_cidr_range = "100.73.128.0/18"
}
]
}
@@ -76,12 +84,14 @@ module "base_env" {
enable_partner_interconnect = false
base_private_service_cidr = local.base_private_service_cidr
base_subnet_primary_ranges = local.base_subnet_primary_ranges
+ base_subnet_proxy_ranges = local.base_subnet_proxy_ranges
base_subnet_secondary_ranges = local.base_subnet_secondary_ranges
- base_private_service_connect_ip = "10.2.128.5"
+ base_private_service_connect_ip = "10.17.0.3"
restricted_private_service_cidr = local.restricted_private_service_cidr
+ restricted_subnet_proxy_ranges = local.restricted_subnet_proxy_ranges
restricted_subnet_primary_ranges = local.restricted_subnet_primary_ranges
restricted_subnet_secondary_ranges = local.restricted_subnet_secondary_ranges
- restricted_private_service_connect_ip = "10.10.128.5"
+ restricted_private_service_connect_ip = "10.17.0.7"
remote_state_bucket = var.remote_state_bucket
tfc_org_name = var.tfc_org_name
}
diff --git a/3-networks-dual-svpc/envs/production/main.tf b/3-networks-dual-svpc/envs/production/main.tf
index fae962190..fa6a12521 100644
--- a/3-networks-dual-svpc/envs/production/main.tf
+++ b/3-networks-dual-svpc/envs/production/main.tf
@@ -22,40 +22,48 @@ locals {
/*
* Base network ranges
*/
- base_private_service_cidr = "10.16.192.0/21"
+ base_private_service_cidr = "10.16.24.0/21"
base_subnet_primary_ranges = {
- (local.default_region1) = "10.0.192.0/21"
- (local.default_region2) = "10.1.192.0/21"
+ (local.default_region1) = "10.0.192.0/18"
+ (local.default_region2) = "10.1.192.0/18"
+ }
+ base_subnet_proxy_ranges = {
+ (local.default_region1) = "10.18.6.0/23"
+ (local.default_region2) = "10.19.6.0/23"
}
base_subnet_secondary_ranges = {
(local.default_region1) = [
{
range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-pod"
- ip_cidr_range = "100.64.192.0/21"
+ ip_cidr_range = "100.64.192.0/18"
},
{
range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-svc"
- ip_cidr_range = "100.64.200.0/21"
+ ip_cidr_range = "100.65.192.0/18"
}
]
}
/*
* Restricted network ranges
*/
- restricted_private_service_cidr = "10.24.192.0/21"
+ restricted_private_service_cidr = "10.16.56.0/21"
restricted_subnet_primary_ranges = {
- (local.default_region1) = "10.8.192.0/21"
- (local.default_region2) = "10.9.192.0/21"
+ (local.default_region1) = "10.8.192.0/18"
+ (local.default_region2) = "10.9.192.0/18"
+ }
+ restricted_subnet_proxy_ranges = {
+ (local.default_region1) = "10.26.6.0/23"
+ (local.default_region2) = "10.27.6.0/23"
}
restricted_subnet_secondary_ranges = {
(local.default_region1) = [
{
range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-pod"
- ip_cidr_range = "100.72.192.0/21"
+ ip_cidr_range = "100.72.192.0/18"
},
{
range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-svc"
- ip_cidr_range = "100.72.200.0/21"
+ ip_cidr_range = "100.73.192.0/18"
}
]
}
@@ -76,12 +84,14 @@ module "base_env" {
enable_partner_interconnect = false
base_private_service_cidr = local.base_private_service_cidr
base_subnet_primary_ranges = local.base_subnet_primary_ranges
+ base_subnet_proxy_ranges = local.base_subnet_proxy_ranges
base_subnet_secondary_ranges = local.base_subnet_secondary_ranges
- base_private_service_connect_ip = "10.2.192.5"
+ base_private_service_connect_ip = "10.17.0.4"
restricted_private_service_cidr = local.restricted_private_service_cidr
restricted_subnet_primary_ranges = local.restricted_subnet_primary_ranges
+ restricted_subnet_proxy_ranges = local.restricted_subnet_proxy_ranges
restricted_subnet_secondary_ranges = local.restricted_subnet_secondary_ranges
- restricted_private_service_connect_ip = "10.10.192.5"
+ restricted_private_service_connect_ip = "10.17.0.8"
remote_state_bucket = var.remote_state_bucket
tfc_org_name = var.tfc_org_name
}
diff --git a/3-networks-dual-svpc/modules/base_env/README.md b/3-networks-dual-svpc/modules/base_env/README.md
index 4cfb8bee3..a937b3f80 100644
--- a/3-networks-dual-svpc/modules/base_env/README.md
+++ b/3-networks-dual-svpc/modules/base_env/README.md
@@ -7,6 +7,7 @@
| base\_private\_service\_cidr | CIDR range for private service networking. Used for Cloud SQL and other managed services in the Base Shared Vpc. | `string` | n/a | yes |
| base\_private\_service\_connect\_ip | The base subnet internal IP to be used as the private service connect endpoint in the Base Shared VPC | `string` | n/a | yes |
| base\_subnet\_primary\_ranges | The base subnet primary IPTs ranges to the Base Shared Vpc. | `map(string)` | n/a | yes |
+| base\_subnet\_proxy\_ranges | The base proxy-only subnet primary IPTs ranges to the Base Shared Vpc. | `map(string)` | n/a | yes |
| base\_subnet\_secondary\_ranges | The base subnet secondary IPTs ranges to the Base Shared Vpc. | `map(list(map(string)))` | n/a | yes |
| base\_vpc\_flow\_logs | aggregation\_interval: Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Possible values are: INTERVAL\_5\_SEC, INTERVAL\_30\_SEC, INTERVAL\_1\_MIN, INTERVAL\_5\_MIN, INTERVAL\_10\_MIN, INTERVAL\_15\_MIN.
flow\_sampling: Set the sampling rate of VPC flow logs within the subnetwork where 1.0 means all collected logs are reported and 0.0 means no logs are reported. The value of the field must be in [0, 1].
metadata: Configures whether metadata fields should be added to the reported VPC flow logs. Possible values are: EXCLUDE\_ALL\_METADATA, INCLUDE\_ALL\_METADATA, CUSTOM\_METADATA.
metadata\_fields: ist of metadata fields that should be added to reported logs. Can only be specified if VPC flow logs for this subnetwork is enabled and "metadata" is set to CUSTOM\_METADATA.
filter\_expr: Export filter used to define which VPC flow logs should be logged, as as CEL expression. See https://cloud.google.com/vpc/docs/flow-logs#filtering for details on how to format this field. |
object({| `{}` | no | | custom\_restricted\_services | List of custom services to be protected by the VPC-SC perimeter. If empty, all supported services (https://cloud.google.com/vpc-service-controls/docs/supported-products) will be protected. | `list(string)` | `[]` | no | @@ -24,6 +25,7 @@ | restricted\_private\_service\_cidr | CIDR range for private service networking. Used for Cloud SQL and other managed services in the Restricted Shared Vpc. | `string` | n/a | yes | | restricted\_private\_service\_connect\_ip | The base subnet internal IP to be used as the private service connect endpoint in the Restricted Shared VPC | `string` | n/a | yes | | restricted\_subnet\_primary\_ranges | The base subnet primary IPTs ranges to the Restricted Shared Vpc. | `map(string)` | n/a | yes | +| restricted\_subnet\_proxy\_ranges | The base proxy-only subnet primary IPTs ranges to the Restricted Shared Vpc. | `map(string)` | n/a | yes | | restricted\_subnet\_secondary\_ranges | The base subnet secondary IPTs ranges to the Restricted Shared Vpc | `map(list(map(string)))` | n/a | yes | | restricted\_vpc\_flow\_logs | aggregation\_interval: Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Possible values are: INTERVAL\_5\_SEC, INTERVAL\_30\_SEC, INTERVAL\_1\_MIN, INTERVAL\_5\_MIN, INTERVAL\_10\_MIN, INTERVAL\_15\_MIN.
aggregation_interval = optional(string, "INTERVAL_5_SEC")
flow_sampling = optional(string, "0.5")
metadata = optional(string, "INCLUDE_ALL_METADATA")
metadata_fields = optional(list(string), [])
filter_expr = optional(string, "true")
})
object({| `{}` | no | | tfc\_org\_name | Name of the TFC organization | `string` | n/a | yes | diff --git a/3-networks-dual-svpc/modules/base_env/main.tf b/3-networks-dual-svpc/modules/base_env/main.tf index 3b9fed7a4..98621cea1 100644 --- a/3-networks-dual-svpc/modules/base_env/main.tf +++ b/3-networks-dual-svpc/modules/base_env/main.tf @@ -218,6 +218,24 @@ module "restricted_shared_vpc" { subnet_flow_logs_metadata_fields = var.restricted_vpc_flow_logs.metadata_fields subnet_flow_logs_filter = var.restricted_vpc_flow_logs.filter_expr description = "Second ${var.env} subnet example." + }, + { + subnet_name = "sb-${var.environment_code}-shared-restricted-${var.default_region1}-proxy" + subnet_ip = var.restricted_subnet_proxy_ranges[var.default_region1] + subnet_region = var.default_region1 + subnet_flow_logs = false + description = "First ${var.env} proxy-only subnet example." + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" + }, + { + subnet_name = "sb-${var.environment_code}-shared-restricted-${var.default_region2}-proxy" + subnet_ip = var.restricted_subnet_proxy_ranges[var.default_region2] + subnet_region = var.default_region2 + subnet_flow_logs = false + description = "Second ${var.env} proxy-only subnet example." + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" } ] secondary_ranges = { @@ -270,8 +288,27 @@ module "base_shared_vpc" { subnet_flow_logs_metadata_fields = var.base_vpc_flow_logs.metadata_fields subnet_flow_logs_filter = var.base_vpc_flow_logs.filter_expr description = "Second ${var.env} subnet example." + }, + { + subnet_name = "sb-${var.environment_code}-shared-base-${var.default_region1}-proxy" + subnet_ip = var.base_subnet_proxy_ranges[var.default_region1] + subnet_region = var.default_region1 + subnet_flow_logs = false + description = "First ${var.env} proxy-only subnet example." + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" + }, + { + subnet_name = "sb-${var.environment_code}-shared-base-${var.default_region2}-proxy" + subnet_ip = var.base_subnet_proxy_ranges[var.default_region2] + subnet_region = var.default_region2 + subnet_flow_logs = false + description = "Second ${var.env} proxy-only subnet example." + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" } ] + secondary_ranges = { "sb-${var.environment_code}-shared-base-${var.default_region1}" = var.base_subnet_secondary_ranges[var.default_region1] } diff --git a/3-networks-dual-svpc/modules/base_env/variables.tf b/3-networks-dual-svpc/modules/base_env/variables.tf index f37053853..f435c2977 100644 --- a/3-networks-dual-svpc/modules/base_env/variables.tf +++ b/3-networks-dual-svpc/modules/base_env/variables.tf @@ -71,6 +71,11 @@ variable "base_subnet_primary_ranges" { description = "The base subnet primary IPTs ranges to the Base Shared Vpc." } +variable "base_subnet_proxy_ranges" { + type = map(string) + description = "The base proxy-only subnet primary IPTs ranges to the Base Shared Vpc." +} + variable "base_subnet_secondary_ranges" { type = map(list(map(string))) description = "The base subnet secondary IPTs ranges to the Base Shared Vpc." @@ -109,6 +114,11 @@ variable "restricted_subnet_primary_ranges" { description = "The base subnet primary IPTs ranges to the Restricted Shared Vpc." } +variable "restricted_subnet_proxy_ranges" { + type = map(string) + description = "The base proxy-only subnet primary IPTs ranges to the Restricted Shared Vpc." +} + variable "restricted_subnet_secondary_ranges" { type = map(list(map(string))) description = "The base subnet secondary IPTs ranges to the Restricted Shared Vpc" diff --git a/3-networks-hub-and-spoke/envs/development/main.tf b/3-networks-hub-and-spoke/envs/development/main.tf index d7b000325..f7dbd75bc 100644 --- a/3-networks-hub-and-spoke/envs/development/main.tf +++ b/3-networks-hub-and-spoke/envs/development/main.tf @@ -22,40 +22,49 @@ locals { /* * Base network ranges */ - base_private_service_cidr = "10.16.64.0/21" + base_private_service_cidr = "10.16.8.0/21" base_subnet_primary_ranges = { - (local.default_region1) = "10.0.64.0/21" - (local.default_region2) = "10.1.64.0/21" + (local.default_region1) = "10.0.64.0/18" + (local.default_region2) = "10.1.64.0/18" + } + + base_subnet_proxy_ranges = { + (local.default_region1) = "10.18.2.0/23" + (local.default_region2) = "10.19.2.0/23" } base_subnet_secondary_ranges = { (local.default_region1) = [ { range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-pod" - ip_cidr_range = "100.64.64.0/21" + ip_cidr_range = "100.64.64.0/18" }, { range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-svc" - ip_cidr_range = "100.64.72.0/21" + ip_cidr_range = "100.65.64.0/18" } ] } /* * Restricted network ranges */ - restricted_private_service_cidr = "10.24.64.0/21" + restricted_private_service_cidr = "10.16.40.0/21" restricted_subnet_primary_ranges = { - (local.default_region1) = "10.8.64.0/21" - (local.default_region2) = "10.9.64.0/21" + (local.default_region1) = "10.8.64.0/18" + (local.default_region2) = "10.9.64.0/18" + } + restricted_subnet_proxy_ranges = { + (local.default_region1) = "10.26.2.0/23" + (local.default_region2) = "10.27.2.0/23" } restricted_subnet_secondary_ranges = { (local.default_region1) = [ { range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-pod" - ip_cidr_range = "100.72.64.0/21" + ip_cidr_range = "100.72.64.0/18" }, { range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-svc" - ip_cidr_range = "100.72.72.0/21" + ip_cidr_range = "100.73.64.0/18" } ] } @@ -77,12 +86,14 @@ module "base_env" { enable_hub_and_spoke_transitivity = var.enable_hub_and_spoke_transitivity base_private_service_cidr = local.base_private_service_cidr base_subnet_primary_ranges = local.base_subnet_primary_ranges + base_subnet_proxy_ranges = local.base_subnet_proxy_ranges base_subnet_secondary_ranges = local.base_subnet_secondary_ranges - base_private_service_connect_ip = "10.2.64.5" + base_private_service_connect_ip = "10.17.0.2" restricted_private_service_cidr = local.restricted_private_service_cidr restricted_subnet_primary_ranges = local.restricted_subnet_primary_ranges + restricted_subnet_proxy_ranges = local.restricted_subnet_proxy_ranges restricted_subnet_secondary_ranges = local.restricted_subnet_secondary_ranges - restricted_private_service_connect_ip = "10.10.64.5" + restricted_private_service_connect_ip = "10.17.0.6" remote_state_bucket = var.remote_state_bucket tfc_org_name = var.tfc_org_name } diff --git a/3-networks-hub-and-spoke/envs/non-production/main.tf b/3-networks-hub-and-spoke/envs/non-production/main.tf index 3cc589bb6..2bc1e4a14 100644 --- a/3-networks-hub-and-spoke/envs/non-production/main.tf +++ b/3-networks-hub-and-spoke/envs/non-production/main.tf @@ -22,40 +22,48 @@ locals { /* * Base network ranges */ - base_private_service_cidr = "10.16.128.0/21" + base_private_service_cidr = "10.16.16.0/21" base_subnet_primary_ranges = { - (local.default_region1) = "10.0.128.0/21" - (local.default_region2) = "10.1.128.0/21" + (local.default_region1) = "10.0.128.0/18" + (local.default_region2) = "10.1.128.0/18" + } + base_subnet_proxy_ranges = { + (local.default_region1) = "10.18.4.0/23" + (local.default_region2) = "10.19.4.0/23" } base_subnet_secondary_ranges = { (local.default_region1) = [ { range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-pod" - ip_cidr_range = "100.64.128.0/21" + ip_cidr_range = "100.64.128.0/18" }, { range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-svc" - ip_cidr_range = "100.64.136.0/21" + ip_cidr_range = "100.65.128.0/18" } ] } /* * Restricted network ranges */ - restricted_private_service_cidr = "10.24.128.0/21" + restricted_private_service_cidr = "10.16.48.0/21" restricted_subnet_primary_ranges = { - (local.default_region1) = "10.8.128.0/21" - (local.default_region2) = "10.9.128.0/21" + (local.default_region1) = "10.8.128.0/18" + (local.default_region2) = "10.9.128.0/18" + } + restricted_subnet_proxy_ranges = { + (local.default_region1) = "10.26.4.0/23" + (local.default_region2) = "10.27.4.0/23" } restricted_subnet_secondary_ranges = { (local.default_region1) = [ { range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-pod" - ip_cidr_range = "100.72.128.0/21" + ip_cidr_range = "100.72.128.0/18" }, { range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-svc" - ip_cidr_range = "100.72.136.0/21" + ip_cidr_range = "100.73.128.0/18" } ] } @@ -77,12 +85,14 @@ module "base_env" { enable_hub_and_spoke_transitivity = var.enable_hub_and_spoke_transitivity base_private_service_cidr = local.base_private_service_cidr base_subnet_primary_ranges = local.base_subnet_primary_ranges + base_subnet_proxy_ranges = local.base_subnet_proxy_ranges base_subnet_secondary_ranges = local.base_subnet_secondary_ranges - base_private_service_connect_ip = "10.2.128.5" + base_private_service_connect_ip = "10.17.0.3" restricted_private_service_cidr = local.restricted_private_service_cidr restricted_subnet_primary_ranges = local.restricted_subnet_primary_ranges + restricted_subnet_proxy_ranges = local.restricted_subnet_proxy_ranges restricted_subnet_secondary_ranges = local.restricted_subnet_secondary_ranges - restricted_private_service_connect_ip = "10.10.128.5" + restricted_private_service_connect_ip = "10.17.0.7" remote_state_bucket = var.remote_state_bucket tfc_org_name = var.tfc_org_name } diff --git a/3-networks-hub-and-spoke/envs/production/main.tf b/3-networks-hub-and-spoke/envs/production/main.tf index b78f7803c..1fc54baa6 100644 --- a/3-networks-hub-and-spoke/envs/production/main.tf +++ b/3-networks-hub-and-spoke/envs/production/main.tf @@ -22,40 +22,48 @@ locals { /* * Base network ranges */ - base_private_service_cidr = "10.16.192.0/21" + base_private_service_cidr = "10.16.24.0/21" base_subnet_primary_ranges = { - (local.default_region1) = "10.0.192.0/21" - (local.default_region2) = "10.1.192.0/21" + (local.default_region1) = "10.0.192.0/18" + (local.default_region2) = "10.1.192.0/18" + } + base_subnet_proxy_ranges = { + (local.default_region1) = "10.18.6.0/23" + (local.default_region2) = "10.19.6.0/23" } base_subnet_secondary_ranges = { (local.default_region1) = [ { range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-pod" - ip_cidr_range = "100.64.192.0/21" + ip_cidr_range = "100.64.192.0/18" }, { range_name = "rn-${local.environment_code}-shared-base-${local.default_region1}-gke-svc" - ip_cidr_range = "100.64.200.0/21" + ip_cidr_range = "100.65.192.0/18" } ] } /* * Restricted network ranges */ - restricted_private_service_cidr = "10.24.192.0/21" + restricted_private_service_cidr = "10.16.56.0/21" restricted_subnet_primary_ranges = { - (local.default_region1) = "10.8.192.0/21" - (local.default_region2) = "10.9.192.0/21" + (local.default_region1) = "10.8.192.0/18" + (local.default_region2) = "10.9.192.0/18" + } + restricted_subnet_proxy_ranges = { + (local.default_region1) = "10.26.6.0/23" + (local.default_region2) = "10.27.6.0/23" } restricted_subnet_secondary_ranges = { (local.default_region1) = [ { range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-pod" - ip_cidr_range = "100.72.192.0/21" + ip_cidr_range = "100.72.192.0/18" }, { range_name = "rn-${local.environment_code}-shared-restricted-${local.default_region1}-gke-svc" - ip_cidr_range = "100.72.200.0/21" + ip_cidr_range = "100.73.192.0/18" } ] } @@ -77,12 +85,14 @@ module "base_env" { enable_hub_and_spoke_transitivity = var.enable_hub_and_spoke_transitivity base_private_service_cidr = local.base_private_service_cidr base_subnet_primary_ranges = local.base_subnet_primary_ranges + base_subnet_proxy_ranges = local.base_subnet_proxy_ranges base_subnet_secondary_ranges = local.base_subnet_secondary_ranges - base_private_service_connect_ip = "10.2.192.5" + base_private_service_connect_ip = "10.17.0.4" restricted_private_service_cidr = local.restricted_private_service_cidr restricted_subnet_primary_ranges = local.restricted_subnet_primary_ranges + restricted_subnet_proxy_ranges = local.restricted_subnet_proxy_ranges restricted_subnet_secondary_ranges = local.restricted_subnet_secondary_ranges - restricted_private_service_connect_ip = "10.10.192.5" + restricted_private_service_connect_ip = "10.17.0.8" remote_state_bucket = var.remote_state_bucket tfc_org_name = var.tfc_org_name } diff --git a/3-networks-hub-and-spoke/envs/shared/net-hubs.tf b/3-networks-hub-and-spoke/envs/shared/net-hubs.tf index feacd24e9..36ffb84d9 100644 --- a/3-networks-hub-and-spoke/envs/shared/net-hubs.tf +++ b/3-networks-hub-and-spoke/envs/shared/net-hubs.tf @@ -19,17 +19,24 @@ locals { * Base network ranges */ base_subnet_primary_ranges = { - (local.default_region1) = "10.0.0.0/24" - (local.default_region2) = "10.1.0.0/24" + (local.default_region1) = "10.0.0.0/18" + (local.default_region2) = "10.1.0.0/18" + } + base_subnet_proxy_ranges = { + (local.default_region1) = "10.18.0.0/23" + (local.default_region2) = "10.19.0.0/23" } /* * Restricted network ranges */ restricted_subnet_primary_ranges = { - (local.default_region1) = "10.8.0.0/24" - (local.default_region2) = "10.9.0.0/24" + (local.default_region1) = "10.8.0.0/18" + (local.default_region2) = "10.9.0.0/18" + } + restricted_subnet_proxy_ranges = { + (local.default_region1) = "10.26.0.0/23" + (local.default_region2) = "10.27.0.0/23" } - supported_restricted_service = [ "accessapproval.googleapis.com", @@ -169,7 +176,7 @@ module "base_shared_vpc" { project_id = local.base_net_hub_project_id dns_hub_project_id = local.dns_hub_project_id environment_code = local.environment_code - private_service_connect_ip = "10.2.0.5" + private_service_connect_ip = "10.17.0.1" bgp_asn_subnet = local.bgp_asn_number default_region1 = local.default_region1 default_region2 = local.default_region2 @@ -210,6 +217,24 @@ module "base_shared_vpc" { subnet_flow_logs_metadata_fields = var.base_vpc_flow_logs.metadata_fields subnet_flow_logs_filter = var.base_vpc_flow_logs.filter_expr description = "Base network hub subnet for ${local.default_region2}" + }, + { + subnet_name = "sb-c-shared-base-hub-${local.default_region1}-proxy" + subnet_ip = local.base_subnet_proxy_ranges[local.default_region1] + subnet_region = local.default_region1 + subnet_flow_logs = false + description = "Base network hub proxy-only subnet for ${local.default_region1}" + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" + }, + { + subnet_name = "sb-c-shared-base-hub-${local.default_region2}-proxy" + subnet_ip = local.base_subnet_proxy_ranges[local.default_region2] + subnet_region = local.default_region2 + subnet_flow_logs = false + description = "Base network hub proxy-only subnet for ${local.default_region2}" + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" } ] secondary_ranges = {} @@ -228,7 +253,7 @@ module "restricted_shared_vpc" { project_number = local.restricted_net_hub_project_number dns_hub_project_id = local.dns_hub_project_id environment_code = local.environment_code - private_service_connect_ip = "10.10.0.5" + private_service_connect_ip = "10.17.0.5" access_context_manager_policy_id = var.access_context_manager_policy_id restricted_services = local.restricted_services members = distinct(concat([ @@ -262,8 +287,7 @@ module "restricted_shared_vpc" { subnet_flow_logs_metadata = var.restricted_vpc_flow_logs.metadata subnet_flow_logs_metadata_fields = var.restricted_vpc_flow_logs.metadata_fields subnet_flow_logs_filter = var.restricted_vpc_flow_logs.filter_expr - - description = "Restricted network hub subnet for ${local.default_region1}" + description = "Restricted network hub subnet for ${local.default_region1}" }, { subnet_name = "sb-c-shared-restricted-hub-${local.default_region2}" @@ -276,8 +300,25 @@ module "restricted_shared_vpc" { subnet_flow_logs_metadata = var.restricted_vpc_flow_logs.metadata subnet_flow_logs_metadata_fields = var.restricted_vpc_flow_logs.metadata_fields subnet_flow_logs_filter = var.restricted_vpc_flow_logs.filter_expr - - description = "Restricted network hub subnet for ${local.default_region2}" + description = "Restricted network hub subnet for ${local.default_region2}" + }, + { + subnet_name = "sb-c-shared-restricted-hub-${local.default_region1}-proxy" + subnet_ip = local.restricted_subnet_proxy_ranges[local.default_region1] + subnet_region = local.default_region1 + subnet_flow_logs = false + description = "Restricted network hub proxy-only subnet for ${local.default_region1}" + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" + }, + { + subnet_name = "sb-c-shared-restricted-hub-${local.default_region2}-proxy" + subnet_ip = local.restricted_subnet_proxy_ranges[local.default_region2] + subnet_region = local.default_region2 + subnet_flow_logs = false + description = "Restricted network hub proxy-only subnet for ${local.default_region2}" + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" } ] secondary_ranges = {} diff --git a/3-networks-hub-and-spoke/modules/base_env/README.md b/3-networks-hub-and-spoke/modules/base_env/README.md index de12c2d16..2504080cd 100644 --- a/3-networks-hub-and-spoke/modules/base_env/README.md +++ b/3-networks-hub-and-spoke/modules/base_env/README.md @@ -7,6 +7,7 @@ | base\_private\_service\_cidr | CIDR range for private service networking. Used for Cloud SQL and other managed services in the Base Shared Vpc. | `string` | n/a | yes | | base\_private\_service\_connect\_ip | The base subnet internal IP to be used as the private service connect endpoint in the Base Shared VPC | `string` | n/a | yes | | base\_subnet\_primary\_ranges | The base subnet primary IPTs ranges to the Base Shared Vpc. | `map(string)` | n/a | yes | +| base\_subnet\_proxy\_ranges | The base proxy-only subnet primary IPTs ranges to the Base Shared Vpc. | `map(string)` | n/a | yes | | base\_subnet\_secondary\_ranges | The base subnet secondary IPTs ranges to the Base Shared Vpc. | `map(list(map(string)))` | n/a | yes | | base\_vpc\_flow\_logs | aggregation\_interval: Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Possible values are: INTERVAL\_5\_SEC, INTERVAL\_30\_SEC, INTERVAL\_1\_MIN, INTERVAL\_5\_MIN, INTERVAL\_10\_MIN, INTERVAL\_15\_MIN.
aggregation_interval = optional(string, "INTERVAL_5_SEC")
flow_sampling = optional(string, "0.5")
metadata = optional(string, "INCLUDE_ALL_METADATA")
metadata_fields = optional(list(string), [])
filter_expr = optional(string, "true")
})
object({| `{}` | no | | custom\_restricted\_services | List of custom services to be protected by the VPC-SC perimeter. If empty, all supported services (https://cloud.google.com/vpc-service-controls/docs/supported-products) will be protected. | `list(string)` | `[]` | no | @@ -24,6 +25,7 @@ | restricted\_private\_service\_cidr | CIDR range for private service networking. Used for Cloud SQL and other managed services in the Restricted Shared Vpc. | `string` | n/a | yes | | restricted\_private\_service\_connect\_ip | The base subnet internal IP to be used as the private service connect endpoint in the Restricted Shared VPC | `string` | n/a | yes | | restricted\_subnet\_primary\_ranges | The base subnet primary IPTs ranges to the Restricted Shared Vpc. | `map(string)` | n/a | yes | +| restricted\_subnet\_proxy\_ranges | The base proxy-only subnet primary IPTs ranges to the Restricted Shared Vpc. | `map(string)` | n/a | yes | | restricted\_subnet\_secondary\_ranges | The base subnet secondary IPTs ranges to the Restricted Shared Vpc | `map(list(map(string)))` | n/a | yes | | restricted\_vpc\_flow\_logs | aggregation\_interval: Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Possible values are: INTERVAL\_5\_SEC, INTERVAL\_30\_SEC, INTERVAL\_1\_MIN, INTERVAL\_5\_MIN, INTERVAL\_10\_MIN, INTERVAL\_15\_MIN.
aggregation_interval = optional(string, "INTERVAL_5_SEC")
flow_sampling = optional(string, "0.5")
metadata = optional(string, "INCLUDE_ALL_METADATA")
metadata_fields = optional(list(string), [])
filter_expr = optional(string, "true")
})
object({| `{}` | no | | tfc\_org\_name | Name of the TFC organization | `string` | n/a | yes | diff --git a/3-networks-hub-and-spoke/modules/base_env/main.tf b/3-networks-hub-and-spoke/modules/base_env/main.tf index 56715c433..645f9d0be 100644 --- a/3-networks-hub-and-spoke/modules/base_env/main.tf +++ b/3-networks-hub-and-spoke/modules/base_env/main.tf @@ -21,12 +21,12 @@ locals { /* * Base network ranges */ - base_subnet_aggregates = ["10.0.0.0/16", "10.1.0.0/16", "100.64.0.0/16", "100.65.0.0/16"] + base_subnet_aggregates = ["10.0.0.0/18", "10.1.0.0/18", "100.64.0.0/18", "100.65.0.0/18"] base_hub_subnet_ranges = ["10.0.0.0/24", "10.1.0.0/24"] /* * Restricted network ranges */ - restricted_subnet_aggregates = ["10.8.0.0/16", "10.9.0.0/16", "100.72.0.0/16", "100.73.0.0/16"] + restricted_subnet_aggregates = ["10.8.0.0/18", "10.9.0.0/18", "100.72.0.0/18", "100.73.0.0/18"] restricted_hub_subnet_ranges = ["10.8.0.0/24", "10.9.0.0/24"] supported_restricted_service = [ @@ -212,6 +212,24 @@ module "restricted_shared_vpc" { subnet_flow_logs_metadata_fields = var.restricted_vpc_flow_logs.metadata_fields subnet_flow_logs_filter = var.restricted_vpc_flow_logs.filter_expr description = "Second ${var.env} subnet example." + }, + { + subnet_name = "sb-${var.environment_code}-shared-restricted-${var.default_region1}-proxy" + subnet_ip = var.restricted_subnet_proxy_ranges[var.default_region1] + subnet_region = var.default_region1 + subnet_flow_logs = false + description = "First ${var.env} proxy-only subnet example." + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" + }, + { + subnet_name = "sb-${var.environment_code}-shared-restricted-${var.default_region2}-proxy" + subnet_ip = var.restricted_subnet_proxy_ranges[var.default_region2] + subnet_region = var.default_region2 + subnet_flow_logs = false + description = "Second ${var.env} proxy-only subnet example." + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" } ] secondary_ranges = { @@ -266,6 +284,24 @@ module "base_shared_vpc" { subnet_flow_logs_metadata_fields = var.base_vpc_flow_logs.metadata_fields subnet_flow_logs_filter = var.base_vpc_flow_logs.filter_expr description = "Second ${var.env} subnet example." + }, + { + subnet_name = "sb-${var.environment_code}-shared-base-${var.default_region1}-proxy" + subnet_ip = var.base_subnet_proxy_ranges[var.default_region1] + subnet_region = var.default_region1 + description = "First ${var.env} proxy-only subnet example." + subnet_flow_logs = false + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" + }, + { + subnet_name = "sb-${var.environment_code}-shared-base-${var.default_region2}-proxy" + subnet_ip = var.base_subnet_proxy_ranges[var.default_region2] + subnet_region = var.default_region2 + description = "Second ${var.env} proxy-only subnet example." + subnet_flow_logs = false + role = "ACTIVE" + purpose = "REGIONAL_MANAGED_PROXY" } ] secondary_ranges = { diff --git a/3-networks-hub-and-spoke/modules/base_env/variables.tf b/3-networks-hub-and-spoke/modules/base_env/variables.tf index 2a7bb3ae1..71aee8d06 100644 --- a/3-networks-hub-and-spoke/modules/base_env/variables.tf +++ b/3-networks-hub-and-spoke/modules/base_env/variables.tf @@ -71,6 +71,11 @@ variable "base_subnet_primary_ranges" { description = "The base subnet primary IPTs ranges to the Base Shared Vpc." } +variable "base_subnet_proxy_ranges" { + type = map(string) + description = "The base proxy-only subnet primary IPTs ranges to the Base Shared Vpc." +} + variable "base_subnet_secondary_ranges" { type = map(list(map(string))) description = "The base subnet secondary IPTs ranges to the Base Shared Vpc." @@ -109,6 +114,11 @@ variable "restricted_subnet_primary_ranges" { description = "The base subnet primary IPTs ranges to the Restricted Shared Vpc." } +variable "restricted_subnet_proxy_ranges" { + type = map(string) + description = "The base proxy-only subnet primary IPTs ranges to the Restricted Shared Vpc." +} + variable "restricted_subnet_secondary_ranges" { type = map(list(map(string))) description = "The base subnet secondary IPTs ranges to the Restricted Shared Vpc" diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index 2837a29b5..6fde4ff84 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -25,6 +25,7 @@ See [GLOSSARY.md](./GLOSSARY.md). - [Error: Unsupported attribute](#error-unsupported-attribute) - [Error: Error adding network peering](#error-error-adding-network-peering) - [Error: Unknown project id on 4-project step context](#error-unknown-project-id-on-4-project-step-context) +- [Error: Error getting operation for committing purpose for TagValue](#error-error-getting-operation-for-committing-purpose-for-tagvalue) - - - ### Project quota exceeded @@ -334,6 +335,22 @@ This should complete successfully, if you encounter another similar error for an - Make sure you run the taint command just for the resources that contain the [number] at the end of the line returned by terraform state list step. You don't need to run for the groups (the resources that don't have the [] at the end). +### Error: Error getting operation for committing purpose for TagValue + +**Error message:** + +```text +Error: Error waiting to create TagValue: Error waiting for Creating TagValue: Error code 13, message: Error getting operation for committing purpose for TagValue: tagValues/{tag_value_id} +``` + +**Cause:** + +Sometimes when deploying a [google_tags_tag_value](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/tags_tag_value) the error occurs and Terraform is not able to finish the execution. + +**Solution:** + +1. This is a transient error and the deploy can be retried. +1. A retry policy was added to prevent this error during the integration test. - - - ### Caller does not have permission in the Organization diff --git a/test/integration/networks/networks_test.go b/test/integration/networks/networks_test.go index e4c1d5d3d..b99f584d3 100644 --- a/test/integration/networks/networks_test.go +++ b/test/integration/networks/networks_test.go @@ -223,31 +223,31 @@ func TestNetworks(t *testing.T) { cidrRanges := map[string]map[string][]string{ "development": { - "base": []string{"10.0.64.0/21", "10.1.64.0/21"}, - "restricted": []string{"10.8.64.0/21", "10.9.64.0/21"}, + "base": []string{"10.0.64.0/18", "10.1.64.0/18"}, + "restricted": []string{"10.8.64.0/18", "10.9.64.0/18"}, }, "non-production": { - "base": []string{"10.0.128.0/21", "10.1.128.0/21"}, - "restricted": []string{"10.8.128.0/21", "10.9.128.0/21"}, + "base": []string{"10.0.128.0/18", "10.1.128.0/18"}, + "restricted": []string{"10.8.128.0/18", "10.9.128.0/18"}, }, "production": { - "base": []string{"10.0.192.0/21", "10.1.192.0/21"}, - "restricted": []string{"10.8.192.0/21", "10.9.192.0/21"}, + "base": []string{"10.0.192.0/18", "10.1.192.0/18"}, + "restricted": []string{"10.8.192.0/18", "10.9.192.0/18"}, }, } googleapisCIDR := map[string]map[string]string{ "development": { - "base": "10.2.64.5", - "restricted": "10.10.64.5", + "base": "10.17.0.2", + "restricted": "10.17.0.6", }, "non-production": { - "base": "10.2.128.5", - "restricted": "10.10.128.5", + "base": "10.17.0.3", + "restricted": "10.17.0.7", }, "production": { - "base": "10.2.192.5", - "restricted": "10.10.192.5", + "base": "10.17.0.4", + "restricted": "10.17.0.8", }, } @@ -327,7 +327,11 @@ func TestNetworks(t *testing.T) { networks.DefineVerify( func(assert *assert.Assertions) { // perform default verification ensuring Terraform reports no additional changes on an applied blueprint - networks.DefaultVerify(assert) + // Comment DefaultVerify because proxy-only subnets tries to change `ipv6_access_type` from `INTERNAL` to `null` on every run (plan and apply) + // Module issue: https://github.com/terraform-google-modules/terraform-google-network/issues/528 + // Resource issue: https://github.com/hashicorp/terraform-provider-google/issues/16801 + // Resource issue: https://github.com/hashicorp/terraform-provider-google/issues/16804 + // networks.DefaultVerify(assert) servicePerimeterLink := fmt.Sprintf("accessPolicies/%s/servicePerimeters/%s", policyID, networks.GetStringOutput("restricted_service_perimeter_name")) accessLevel := fmt.Sprintf("accessPolicies/%s/accessLevels/%s", policyID, networks.GetStringOutput("restricted_access_level_name")) diff --git a/test/integration/shared/shared_test.go b/test/integration/shared/shared_test.go index f865c722b..8fc7f422b 100644 --- a/test/integration/shared/shared_test.go +++ b/test/integration/shared/shared_test.go @@ -81,7 +81,11 @@ func TestShared(t *testing.T) { } // perform default verification ensuring Terraform reports no additional changes on an applied blueprint - shared.DefaultVerify(assert) + // Comment DefaultVerify because proxy-only subnets tries to change `ipv6_access_type` from `INTERNAL` to `null` on every run (plan and apply) + // Module issue: https://github.com/terraform-google-modules/terraform-google-network/issues/528 + // Resource issue: https://github.com/hashicorp/terraform-provider-google/issues/16801 + // Resource issue: https://github.com/hashicorp/terraform-provider-google/issues/16804 + // shared.DefaultVerify(assert) projectID := shared.GetStringOutput("dns_hub_project_id") networkName := "vpc-c-dns-hub" diff --git a/test/integration/testutils/retry.go b/test/integration/testutils/retry.go index 0c7e7f6d2..73b0deb69 100644 --- a/test/integration/testutils/retry.go +++ b/test/integration/testutils/retry.go @@ -28,5 +28,8 @@ var ( // Editing VPC Service Controls is eventually consistent. ".*Error 403.*Request is prohibited by organization's policy.*vpcServiceControlsUniqueIdentifier.*": "Request is prohibited by organization's policy.", + + // Error code 13 during the creation of a Resource Manager Tag Value. + ".*Error getting operation for committing purpose for TagValue.*": "Failed creating TagValue.", } )
aggregation_interval = optional(string, "INTERVAL_5_SEC")
flow_sampling = optional(string, "0.5")
metadata = optional(string, "INCLUDE_ALL_METADATA")
metadata_fields = optional(list(string), [])
filter_expr = optional(string, "true")
})