diff --git a/modules/net-vpc/README.md b/modules/net-vpc/README.md index d89fde140..5820afe5e 100644 --- a/modules/net-vpc/README.md +++ b/modules/net-vpc/README.md @@ -675,11 +675,11 @@ module "vpc" { | [routing_mode](variables.tf#L231) | The network routing mode (default 'GLOBAL'). | string | | "GLOBAL" | | [shared_vpc_host](variables.tf#L241) | Enable shared VPC for this project. | bool | | false | | [shared_vpc_service_projects](variables.tf#L247) | Shared VPC service projects to register with this host. | list(string) | | [] | -| [subnets](variables.tf#L253) | Subnet configuration. | list(object({…})) | | [] | -| [subnets_private_nat](variables.tf#L299) | List of private NAT subnets. | list(object({…})) | | [] | -| [subnets_proxy_only](variables.tf#L311) | List of proxy-only subnets for Regional HTTPS or Internal HTTPS load balancers. Note: Only one proxy-only subnet for each VPC network in each region can be active. | list(object({…})) | | [] | -| [subnets_psc](variables.tf#L345) | List of subnets for Private Service Connect service producers. | list(object({…})) | | [] | -| [vpc_create](variables.tf#L377) | Create VPC. When set to false, uses a data source to reference existing VPC. | bool | | true | +| [subnets](variables.tf#L253) | Subnet configuration. | list(object({…})) | | [] | +| [subnets_private_nat](variables.tf#L300) | List of private NAT subnets. | list(object({…})) | | [] | +| [subnets_proxy_only](variables.tf#L312) | List of proxy-only subnets for Regional HTTPS or Internal HTTPS load balancers. Note: Only one proxy-only subnet for each VPC network in each region can be active. | list(object({…})) | | [] | +| [subnets_psc](variables.tf#L346) | List of subnets for Private Service Connect service producers. | list(object({…})) | | [] | +| [vpc_create](variables.tf#L378) | Create VPC. When set to false, uses a data source to reference existing VPC. | bool | | true | ## Outputs diff --git a/modules/net-vpc/subnets.tf b/modules/net-vpc/subnets.tf index 09ae70f8d..8d82a2aad 100644 --- a/modules/net-vpc/subnets.tf +++ b/modules/net-vpc/subnets.tf @@ -28,9 +28,10 @@ locals { _factory_subnets = { for k, v in local._factory_data : "${v.region_computed}/${try(v.name, k)}" => { - active = try(v.active, true) - description = try(v.description, null) - enable_private_access = try(v.enable_private_access, true) + active = try(v.active, true) + description = try(v.description, null) + enable_private_access = try(v.enable_private_access, true) + allow_subnet_cidr_routes_overlap = try(v.allow_subnet_cidr_routes_overlap, null) flow_logs_config = can(v.flow_logs_config) ? { aggregation_interval = try(v.flow_logs_config.aggregation_interval, null) filter_expression = try(v.flow_logs_config.filter_expression, null) @@ -138,12 +139,14 @@ locals { } resource "google_compute_subnetwork" "subnetwork" { - for_each = local.subnets - project = var.project_id - network = local.network.name - name = each.value.name - region = each.value.region - ip_cidr_range = each.value.ip_cidr_range + provider = google-beta + for_each = local.subnets + project = var.project_id + network = local.network.name + name = each.value.name + region = each.value.region + ip_cidr_range = each.value.ip_cidr_range + allow_subnet_cidr_routes_overlap = each.value.allow_subnet_cidr_routes_overlap description = ( each.value.description == null ? "Terraform-managed." diff --git a/modules/net-vpc/variables.tf b/modules/net-vpc/variables.tf index ca088b370..f866ed8f3 100644 --- a/modules/net-vpc/variables.tf +++ b/modules/net-vpc/variables.tf @@ -253,11 +253,12 @@ variable "shared_vpc_service_projects" { variable "subnets" { description = "Subnet configuration." type = list(object({ - name = string - ip_cidr_range = string - region = string - description = optional(string) - enable_private_access = optional(bool, true) + name = string + ip_cidr_range = string + region = string + description = optional(string) + enable_private_access = optional(bool, true) + allow_subnet_cidr_routes_overlap = optional(bool, null) flow_logs_config = optional(object({ aggregation_interval = optional(string) filter_expression = optional(string)