fix backwards compatibility for vpc subnet descriptions (#926)
This commit is contained in:
parent
f8e525556d
commit
29cde275f0
|
@ -276,8 +276,8 @@ flow_logs: # enable, set to empty map to use defaults
|
||||||
| [subnet_iam](variables.tf#L133) | Subnet IAM bindings in {REGION/NAME => {ROLE => [MEMBERS]} format. | <code>map(map(list(string)))</code> | | <code>{}</code> |
|
| [subnet_iam](variables.tf#L133) | Subnet IAM bindings in {REGION/NAME => {ROLE => [MEMBERS]} format. | <code>map(map(list(string)))</code> | | <code>{}</code> |
|
||||||
| [subnets](variables.tf#L139) | Subnet configuration. | <code title="list(object({ name = string ip_cidr_range = string region = string description = optional(string) enable_private_access = optional(bool, true) flow_logs_config = optional(object({ aggregation_interval = optional(string) filter_expression = optional(string) flow_sampling = optional(number) metadata = optional(string) metadata_fields = optional(list(string)) })) ipv6 = optional(object({ access_type = optional(string) enable_private_access = optional(bool, true) })) secondary_ip_ranges = optional(map(string)) }))">list(object({…}))</code> | | <code>[]</code> |
|
| [subnets](variables.tf#L139) | Subnet configuration. | <code title="list(object({ name = string ip_cidr_range = string region = string description = optional(string) enable_private_access = optional(bool, true) flow_logs_config = optional(object({ aggregation_interval = optional(string) filter_expression = optional(string) flow_sampling = optional(number) metadata = optional(string) metadata_fields = optional(list(string)) })) ipv6 = optional(object({ access_type = optional(string) enable_private_access = optional(bool, true) })) secondary_ip_ranges = optional(map(string)) }))">list(object({…}))</code> | | <code>[]</code> |
|
||||||
| [subnets_proxy_only](variables.tf#L164) | 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. | <code title="list(object({ name = string ip_cidr_range = string region = string description = optional(string) active = bool }))">list(object({…}))</code> | | <code>[]</code> |
|
| [subnets_proxy_only](variables.tf#L164) | 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. | <code title="list(object({ name = string ip_cidr_range = string region = string description = optional(string) active = bool }))">list(object({…}))</code> | | <code>[]</code> |
|
||||||
| [subnets_psc](variables.tf#L176) | List of subnets for Private Service Connect service producers. | <code title="list(object({ name = string ip_cidr_range = string region = string }))">list(object({…}))</code> | | <code>[]</code> |
|
| [subnets_psc](variables.tf#L176) | List of subnets for Private Service Connect service producers. | <code title="list(object({ name = string ip_cidr_range = string region = string description = optional(string) }))">list(object({…}))</code> | | <code>[]</code> |
|
||||||
| [vpc_create](variables.tf#L186) | Create VPC. When set to false, uses a data source to reference existing VPC. | <code>bool</code> | | <code>true</code> |
|
| [vpc_create](variables.tf#L187) | Create VPC. When set to false, uses a data source to reference existing VPC. | <code>bool</code> | | <code>true</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,17 @@ locals {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_subnetwork" "subnetwork" {
|
resource "google_compute_subnetwork" "subnetwork" {
|
||||||
for_each = local.subnets
|
for_each = local.subnets
|
||||||
project = var.project_id
|
project = var.project_id
|
||||||
network = local.network.name
|
network = local.network.name
|
||||||
name = each.value.name
|
name = each.value.name
|
||||||
region = each.value.region
|
region = each.value.region
|
||||||
ip_cidr_range = each.value.ip_cidr_range
|
ip_cidr_range = each.value.ip_cidr_range
|
||||||
description = try(each.value.description, "Terraform-managed.")
|
description = (
|
||||||
|
each.value.description == null
|
||||||
|
? "Terraform-managed."
|
||||||
|
: each.value.description
|
||||||
|
)
|
||||||
private_ip_google_access = each.value.enable_private_access
|
private_ip_google_access = each.value.enable_private_access
|
||||||
secondary_ip_range = each.value.secondary_ip_ranges == null ? [] : [
|
secondary_ip_range = each.value.secondary_ip_ranges == null ? [] : [
|
||||||
for name, range in each.value.secondary_ip_ranges :
|
for name, range in each.value.secondary_ip_ranges :
|
||||||
|
@ -107,9 +111,10 @@ resource "google_compute_subnetwork" "proxy_only" {
|
||||||
name = each.value.name
|
name = each.value.name
|
||||||
region = each.value.region
|
region = each.value.region
|
||||||
ip_cidr_range = each.value.ip_cidr_range
|
ip_cidr_range = each.value.ip_cidr_range
|
||||||
description = try(
|
description = (
|
||||||
each.value.description,
|
each.value.description == null
|
||||||
"Terraform-managed proxy-only subnet for Regional HTTPS or Internal HTTPS LB."
|
? "Terraform-managed proxy-only subnet for Regional HTTPS or Internal HTTPS LB."
|
||||||
|
: each.value.description
|
||||||
)
|
)
|
||||||
purpose = "REGIONAL_MANAGED_PROXY"
|
purpose = "REGIONAL_MANAGED_PROXY"
|
||||||
role = (
|
role = (
|
||||||
|
@ -124,9 +129,10 @@ resource "google_compute_subnetwork" "psc" {
|
||||||
name = each.value.name
|
name = each.value.name
|
||||||
region = each.value.region
|
region = each.value.region
|
||||||
ip_cidr_range = each.value.ip_cidr_range
|
ip_cidr_range = each.value.ip_cidr_range
|
||||||
description = try(
|
description = (
|
||||||
each.value.description,
|
each.value.description == null
|
||||||
"Terraform-managed subnet for Private Service Connect (PSC NAT)."
|
? "Terraform-managed subnet for Private Service Connect (PSC NAT)."
|
||||||
|
: each.value.description
|
||||||
)
|
)
|
||||||
purpose = "PRIVATE_SERVICE_CONNECT"
|
purpose = "PRIVATE_SERVICE_CONNECT"
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,6 +179,7 @@ variable "subnets_psc" {
|
||||||
name = string
|
name = string
|
||||||
ip_cidr_range = string
|
ip_cidr_range = string
|
||||||
region = string
|
region = string
|
||||||
|
description = optional(string)
|
||||||
}))
|
}))
|
||||||
default = []
|
default = []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue