diff --git a/modules/net-lb-app-ext-regional/README.md b/modules/net-lb-app-ext-regional/README.md index 35ae6a456..eb685f9ea 100644 --- a/modules/net-lb-app-ext-regional/README.md +++ b/modules/net-lb-app-ext-regional/README.md @@ -803,22 +803,23 @@ For deploying changes to load balancer configuration please refer to [net-lb-app | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L61) | Load balancer name. | string | ✓ | | -| [project_id](variables.tf#L187) | Project id. | string | ✓ | | -| [region](variables.tf#L205) | Region where the load balancer is created. | string | ✓ | | -| [vpc](variables.tf#L225) | VPC-level configuration. | string | ✓ | | +| [name](variables.tf#L73) | Load balancer name. | string | ✓ | | +| [project_id](variables.tf#L199) | Project id. | string | ✓ | | +| [region](variables.tf#L217) | Region where the load balancer is created. | string | ✓ | | +| [vpc](variables.tf#L237) | VPC-level configuration. | string | ✓ | | | [address](variables.tf#L17) | Optional IP address used for the forwarding rule. | string | | null | | [backend_service_configs](variables-backend-service.tf#L19) | Backend service level configuration. | map(object({…})) | | {} | | [description](variables.tf#L23) | Optional description used for resources. | string | | "Terraform managed." | -| [group_configs](variables.tf#L29) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [group_configs](variables.tf#L29) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | | [health_check_configs](variables-health-check.tf#L19) | Optional auto-created health check configurations, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | map(object({…})) | | {…} | -| [https_proxy_config](variables.tf#L41) | HTTPS proxy connfiguration. | object({…}) | | {} | -| [labels](variables.tf#L55) | Labels set on resources. | map(string) | | {} | -| [neg_configs](variables.tf#L66) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | -| [network_tier_standard](variables.tf#L170) | Use standard network tier. | bool | | true | -| [ports](variables.tf#L177) | Optional ports for HTTP load balancer. | list(string) | | null | -| [protocol](variables.tf#L192) | Protocol supported by this load balancer. | string | | "HTTP" | -| [ssl_certificates](variables.tf#L210) | SSL target proxy certificates (only if protocol is HTTPS) for existing, custom, and managed certificates. | object({…}) | | {} | +| [http_proxy_config](variables.tf#L43) | HTTP proxy configuration. | object({…}) | | {} | +| [https_proxy_config](variables.tf#L53) | HTTPS proxy connfiguration. | object({…}) | | {} | +| [labels](variables.tf#L67) | Labels set on resources. | map(string) | | {} | +| [neg_configs](variables.tf#L78) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [network_tier_standard](variables.tf#L182) | Use standard network tier. | bool | | true | +| [ports](variables.tf#L189) | Optional ports for HTTP load balancer. | list(string) | | null | +| [protocol](variables.tf#L204) | Protocol supported by this load balancer. | string | | "HTTP" | +| [ssl_certificates](variables.tf#L222) | SSL target proxy certificates (only if protocol is HTTPS) for existing, custom, and managed certificates. | object({…}) | | {} | | [urlmap_config](variables-urlmap.tf#L19) | The URL map configuration. | object({…}) | | {…} | ## Outputs diff --git a/modules/net-lb-app-ext-regional/groups.tf b/modules/net-lb-app-ext-regional/groups.tf index 285ca79a3..382201807 100644 --- a/modules/net-lb-app-ext-regional/groups.tf +++ b/modules/net-lb-app-ext-regional/groups.tf @@ -22,8 +22,8 @@ resource "google_compute_instance_group" "default" { : each.value.project_id ) zone = each.value.zone - name = "${var.name}-${each.key}" - description = var.description + name = coalesce(each.value.name, "${var.name}-${each.key}") + description = each.value.description instances = each.value.instances dynamic "named_port" { diff --git a/modules/net-lb-app-ext-regional/main.tf b/modules/net-lb-app-ext-regional/main.tf index 74b77eec5..bcad21818 100644 --- a/modules/net-lb-app-ext-regional/main.tf +++ b/modules/net-lb-app-ext-regional/main.tf @@ -61,8 +61,8 @@ resource "google_compute_region_target_http_proxy" "default" { count = var.protocol == "HTTPS" ? 0 : 1 project = var.project_id region = var.region - name = var.name - description = var.description + name = coalesce(var.http_proxy_config.name, var.name) + description = var.http_proxy_config.description url_map = google_compute_region_url_map.default.id } diff --git a/modules/net-lb-app-ext-regional/variables.tf b/modules/net-lb-app-ext-regional/variables.tf index 3389e8c52..89b9610c8 100644 --- a/modules/net-lb-app-ext-regional/variables.tf +++ b/modules/net-lb-app-ext-regional/variables.tf @@ -29,6 +29,8 @@ variable "description" { variable "group_configs" { description = "Optional unmanaged groups to create. Can be referenced in backends via key or outputs." type = map(object({ + name = optional(string) + description = optional(string, "Terraform managed.") zone = string instances = optional(list(string)) named_ports = optional(map(number), {}) @@ -38,6 +40,16 @@ variable "group_configs" { nullable = false } +variable "http_proxy_config" { + description = "HTTP proxy configuration." + type = object({ + name = optional(string) + description = optional(string, "Terraform managed.") + }) + default = {} + nullable = false +} + variable "https_proxy_config" { description = "HTTPS proxy connfiguration." type = object({ diff --git a/modules/net-lb-app-ext/README.md b/modules/net-lb-app-ext/README.md index 6a6b0c95c..a1755fe29 100644 --- a/modules/net-lb-app-ext/README.md +++ b/modules/net-lb-app-ext/README.md @@ -1062,22 +1062,22 @@ After provisioning this change, and verifying that the new certificate is provis | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L123) | Load balancer name. | string | ✓ | | -| [project_id](variables.tf#L238) | Project id. | string | ✓ | | -| [backend_buckets_config](variables.tf#L17) | Backend buckets configuration. | map(object({…})) | | {} | +| [name](variables.tf#L126) | Load balancer name. | string | ✓ | | +| [project_id](variables.tf#L241) | Project id. | string | ✓ | | +| [backend_buckets_config](variables.tf#L17) | Backend buckets configuration. | map(object({…})) | | {} | | [backend_service_configs](variables-backend-service.tf#L19) | Backend service level configuration. | map(object({…})) })) | | {} | -| [description](variables.tf#L51) | Optional description used for resources. | string | | "Terraform managed." | -| [forwarding_rules_config](variables.tf#L57) | The optional forwarding rules configuration. | map(object({…})) | | {…} | -| [group_configs](variables.tf#L78) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [description](variables.tf#L52) | Optional description used for resources. | string | | "Terraform managed." | +| [forwarding_rules_config](variables.tf#L58) | The optional forwarding rules configuration. | map(object({…})) | | {…} | +| [group_configs](variables.tf#L79) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | | [health_check_configs](variables-health-check.tf#L19) | Optional auto-created health check configurations, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | map(object({…})) | | {…} | -| [http_proxy_config](variables.tf#L90) | HTTP proxy configuration. Only used for non-classic load balancers. | object({…}) | | {} | -| [https_proxy_config](variables.tf#L101) | HTTPS proxy connfiguration. | object({…}) | | {} | -| [labels](variables.tf#L117) | Labels set on resources. | map(string) | | {} | -| [neg_configs](variables.tf#L128) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | -| [protocol](variables.tf#L243) | Protocol supported by this load balancer. | string | | "HTTP" | -| [ssl_certificates](variables.tf#L256) | SSL target proxy certificates (only if protocol is HTTPS) for existing, custom, and managed certificates. | object({…}) | | {} | +| [http_proxy_config](variables.tf#L93) | HTTP proxy configuration. Only used for non-classic load balancers. | object({…}) | | {} | +| [https_proxy_config](variables.tf#L104) | HTTPS proxy connfiguration. | object({…}) | | {} | +| [labels](variables.tf#L120) | Labels set on resources. | map(string) | | {} | +| [neg_configs](variables.tf#L131) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [protocol](variables.tf#L246) | Protocol supported by this load balancer. | string | | "HTTP" | +| [ssl_certificates](variables.tf#L259) | SSL target proxy certificates (only if protocol is HTTPS) for existing, custom, and managed certificates. | object({…}) | | {} | | [urlmap_config](variables-urlmap.tf#L19) | The URL map configuration. | object({…}) | | {…} | -| [use_classic_version](variables.tf#L274) | Use classic Global Load Balancer. | bool | | true | +| [use_classic_version](variables.tf#L277) | Use classic Global Load Balancer. | bool | | true | ## Outputs diff --git a/modules/net-lb-app-ext/backends.tf b/modules/net-lb-app-ext/backends.tf index a025aa423..cb0d6b200 100644 --- a/modules/net-lb-app-ext/backends.tf +++ b/modules/net-lb-app-ext/backends.tf @@ -23,7 +23,7 @@ resource "google_compute_backend_bucket" "default" { ? var.project_id : each.value.project_id ) - name = "${var.name}-${each.key}" + name = coalesce(each.value.name, "${var.name}-${each.key}") bucket_name = each.value.bucket_name compression_mode = each.value.compression_mode custom_response_headers = each.value.custom_response_headers diff --git a/modules/net-lb-app-ext/groups.tf b/modules/net-lb-app-ext/groups.tf index 285ca79a3..382201807 100644 --- a/modules/net-lb-app-ext/groups.tf +++ b/modules/net-lb-app-ext/groups.tf @@ -22,8 +22,8 @@ resource "google_compute_instance_group" "default" { : each.value.project_id ) zone = each.value.zone - name = "${var.name}-${each.key}" - description = var.description + name = coalesce(each.value.name, "${var.name}-${each.key}") + description = each.value.description instances = each.value.instances dynamic "named_port" { diff --git a/modules/net-lb-app-ext/main.tf b/modules/net-lb-app-ext/main.tf index 4b617f161..e4a8e0b18 100644 --- a/modules/net-lb-app-ext/main.tf +++ b/modules/net-lb-app-ext/main.tf @@ -120,10 +120,11 @@ resource "google_compute_target_http_proxy" "new" { count = ( var.protocol == "HTTP" && !var.use_classic_version ? 1 : 0 ) - project = var.project_id - name = coalesce(var.https_proxy_config.name, var.name) - description = var.http_proxy_config.description - url_map = google_compute_url_map.default.id + project = var.project_id + name = coalesce(var.http_proxy_config.name, var.name) + description = var.http_proxy_config.description + http_keep_alive_timeout_sec = var.http_proxy_config.http_keepalive_timeout + url_map = google_compute_url_map.default.id } resource "google_compute_target_https_proxy" "new" { diff --git a/modules/net-lb-app-ext/variables.tf b/modules/net-lb-app-ext/variables.tf index 69be84ecf..50df463a3 100644 --- a/modules/net-lb-app-ext/variables.tf +++ b/modules/net-lb-app-ext/variables.tf @@ -18,6 +18,7 @@ variable "backend_buckets_config" { description = "Backend buckets configuration." type = map(object({ bucket_name = string + name = optional(string) compression_mode = optional(string) custom_response_headers = optional(list(string)) description = optional(string) @@ -78,6 +79,8 @@ variable "forwarding_rules_config" { variable "group_configs" { description = "Optional unmanaged groups to create. Can be referenced in backends via key or outputs." type = map(object({ + name = optional(string) + description = optional(string, "Terraform managed.") zone = string instances = optional(list(string)) named_ports = optional(map(number), {}) diff --git a/modules/net-lb-app-int-cross-region/README.md b/modules/net-lb-app-int-cross-region/README.md index f12fb801b..e4fd58cdf 100644 --- a/modules/net-lb-app-int-cross-region/README.md +++ b/modules/net-lb-app-int-cross-region/README.md @@ -819,22 +819,22 @@ When deploying changes to load balancer configuration please refer to [net-lb-ap | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L72) | Load balancer name. | string | ✓ | | -| [project_id](variables.tf#L153) | Project id. | string | ✓ | | -| [vpc_config](variables.tf#L195) | VPC-level configuration. | object({…}) | ✓ | | +| [name](variables.tf#L74) | Load balancer name. | string | ✓ | | +| [project_id](variables.tf#L155) | Project id. | string | ✓ | | +| [vpc_config](variables.tf#L197) | VPC-level configuration. | object({…}) | ✓ | | | [addresses](variables.tf#L17) | Optional IP address used for the forwarding rule. | map(string) | | null | | [backend_service_configs](variables-backend-service.tf#L19) | Backend service level configuration. | map(object({…})) | | {} | | [description](variables.tf#L23) | Optional description used for resources. | string | | "Terraform managed." | -| [group_configs](variables.tf#L29) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [group_configs](variables.tf#L29) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | | [health_check_configs](variables-health-check.tf#L19) | Optional auto-created health check configurations, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | map(object({…})) | | {…} | -| [http_proxy_config](variables.tf#L41) | HTTP proxy configuration. | object({…}) | | {} | -| [https_proxy_config](variables.tf#L52) | HTTPS proxy configuration. | object({…}) | | {} | -| [labels](variables.tf#L66) | Labels set on resources. | map(string) | | {} | -| [neg_configs](variables.tf#L77) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | -| [ports](variables.tf#L143) | Optional ports for HTTP load balancer. | list(string) | | null | -| [protocol](variables.tf#L158) | Protocol supported by this load balancer. | string | | "HTTP" | -| [service_attachment](variables.tf#L171) | PSC service attachments. | object({…}) | | null | -| [service_directory_registration](variables.tf#L186) | Service directory namespace and service used to register this load balancer. | object({…}) | | null | +| [http_proxy_config](variables.tf#L43) | HTTP proxy configuration. | object({…}) | | {} | +| [https_proxy_config](variables.tf#L54) | HTTPS proxy configuration. | object({…}) | | {} | +| [labels](variables.tf#L68) | Labels set on resources. | map(string) | | {} | +| [neg_configs](variables.tf#L79) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [ports](variables.tf#L145) | Optional ports for HTTP load balancer. | list(string) | | null | +| [protocol](variables.tf#L160) | Protocol supported by this load balancer. | string | | "HTTP" | +| [service_attachment](variables.tf#L173) | PSC service attachments. | object({…}) | | null | +| [service_directory_registration](variables.tf#L188) | Service directory namespace and service used to register this load balancer. | object({…}) | | null | | [urlmap_config](variables-urlmap.tf#L19) | The URL map configuration. | object({…}) | | {…} | ## Outputs diff --git a/modules/net-lb-app-int-cross-region/groups.tf b/modules/net-lb-app-int-cross-region/groups.tf index 53ba6b27f..c280e7ae9 100644 --- a/modules/net-lb-app-int-cross-region/groups.tf +++ b/modules/net-lb-app-int-cross-region/groups.tf @@ -22,8 +22,8 @@ resource "google_compute_instance_group" "default" { : each.value.project_id ) zone = each.value.zone - name = "${var.name}-${each.key}" - description = var.description + name = coalesce(each.value.name, "${var.name}-${each.key}") + description = each.value.description instances = each.value.instances dynamic "named_port" { diff --git a/modules/net-lb-app-int-cross-region/main.tf b/modules/net-lb-app-int-cross-region/main.tf index 0d2eec43f..e4e494457 100644 --- a/modules/net-lb-app-int-cross-region/main.tf +++ b/modules/net-lb-app-int-cross-region/main.tf @@ -80,11 +80,12 @@ resource "google_compute_global_forwarding_rule" "forwarding_rules" { } resource "google_compute_target_http_proxy" "default" { - count = var.protocol == "HTTPS" ? 0 : 1 - project = var.project_id - name = coalesce(var.https_proxy_config.name, var.name) - description = var.http_proxy_config.description - url_map = google_compute_url_map.default.id + count = var.protocol == "HTTPS" ? 0 : 1 + project = var.project_id + name = coalesce(var.http_proxy_config.name, var.name) + description = var.http_proxy_config.description + http_keep_alive_timeout_sec = var.http_proxy_config.http_keepalive_timeout + url_map = google_compute_url_map.default.id } resource "google_compute_target_https_proxy" "default" { diff --git a/modules/net-lb-app-int-cross-region/variables.tf b/modules/net-lb-app-int-cross-region/variables.tf index 02eadbd9d..3fb032f92 100644 --- a/modules/net-lb-app-int-cross-region/variables.tf +++ b/modules/net-lb-app-int-cross-region/variables.tf @@ -29,6 +29,8 @@ variable "description" { variable "group_configs" { description = "Optional unmanaged groups to create. Can be referenced in backends via key or outputs." type = map(object({ + name = optional(string) + description = optional(string, "Terraform managed.") zone = string instances = optional(list(string)) named_ports = optional(map(number), {}) diff --git a/modules/net-lb-app-int/README.md b/modules/net-lb-app-int/README.md index 46c926e4e..10876d9a1 100644 --- a/modules/net-lb-app-int/README.md +++ b/modules/net-lb-app-int/README.md @@ -821,25 +821,26 @@ For deploying changes to load balancer configuration please refer to [net-lb-app | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L66) | Load balancer name. | string | ✓ | | -| [project_id](variables.tf#L166) | Project id. | string | ✓ | | -| [region](variables.tf#L184) | The region where to allocate the ILB resources. | string | ✓ | | -| [vpc_config](variables.tf#L227) | VPC-level configuration. | object({…}) | ✓ | | +| [name](variables.tf#L78) | Load balancer name. | string | ✓ | | +| [project_id](variables.tf#L178) | Project id. | string | ✓ | | +| [region](variables.tf#L196) | The region where to allocate the ILB resources. | string | ✓ | | +| [vpc_config](variables.tf#L239) | VPC-level configuration. | object({…}) | ✓ | | | [address](variables.tf#L17) | Optional IP address used for the forwarding rule. | string | | null | | [backend_service_configs](variables-backend-service.tf#L19) | Backend service level configuration. | map(object({…})) | | {} | | [description](variables.tf#L23) | Optional description used for resources. | string | | "Terraform managed." | | [global_access](variables.tf#L30) | Allow client access from all regions. | bool | | null | -| [group_configs](variables.tf#L36) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [group_configs](variables.tf#L36) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | | [health_check_configs](variables-health-check.tf#L19) | Optional auto-created health check configurations, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | map(object({…})) | | {…} | -| [https_proxy_config](variables.tf#L48) | HTTPS proxy configuration. | object({…}) | | {} | -| [labels](variables.tf#L60) | Labels set on resources. | map(string) | | {} | -| [neg_configs](variables.tf#L71) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | -| [network_tier_premium](variables.tf#L149) | Use premium network tier. Defaults to true. | bool | | true | -| [ports](variables.tf#L156) | Optional ports for HTTP load balancer. | list(string) | | null | -| [protocol](variables.tf#L171) | Protocol supported by this load balancer. | string | | "HTTP" | -| [service_attachment](variables.tf#L189) | PSC service attachment. | object({…}) | | null | -| [service_directory_registration](variables.tf#L204) | Service directory namespace and service used to register this load balancer. | object({…}) | | null | -| [ssl_certificates](variables.tf#L213) | SSL target proxy certificates (only if protocol is HTTPS). | object({…}) | | {} | +| [http_proxy_config](variables.tf#L50) | HTTP proxy configuration. Only used for non-classic load balancers. | object({…}) | | {} | +| [https_proxy_config](variables.tf#L60) | HTTPS proxy configuration. | object({…}) | | {} | +| [labels](variables.tf#L72) | Labels set on resources. | map(string) | | {} | +| [neg_configs](variables.tf#L83) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [network_tier_premium](variables.tf#L161) | Use premium network tier. Defaults to true. | bool | | true | +| [ports](variables.tf#L168) | Optional ports for HTTP load balancer. | list(string) | | null | +| [protocol](variables.tf#L183) | Protocol supported by this load balancer. | string | | "HTTP" | +| [service_attachment](variables.tf#L201) | PSC service attachment. | object({…}) | | null | +| [service_directory_registration](variables.tf#L216) | Service directory namespace and service used to register this load balancer. | object({…}) | | null | +| [ssl_certificates](variables.tf#L225) | SSL target proxy certificates (only if protocol is HTTPS). | object({…}) | | {} | | [urlmap_config](variables-urlmap.tf#L19) | The URL map configuration. | object({…}) | | {…} | ## Outputs diff --git a/modules/net-lb-app-int/groups.tf b/modules/net-lb-app-int/groups.tf index 53ba6b27f..c280e7ae9 100644 --- a/modules/net-lb-app-int/groups.tf +++ b/modules/net-lb-app-int/groups.tf @@ -22,8 +22,8 @@ resource "google_compute_instance_group" "default" { : each.value.project_id ) zone = each.value.zone - name = "${var.name}-${each.key}" - description = var.description + name = coalesce(each.value.name, "${var.name}-${each.key}") + description = each.value.description instances = each.value.instances dynamic "named_port" { diff --git a/modules/net-lb-app-int/main.tf b/modules/net-lb-app-int/main.tf index f562beb79..ae2fbbbd1 100644 --- a/modules/net-lb-app-int/main.tf +++ b/modules/net-lb-app-int/main.tf @@ -102,8 +102,8 @@ resource "google_compute_region_target_http_proxy" "default" { count = var.protocol == "HTTPS" ? 0 : 1 project = var.project_id region = var.region - name = var.name - description = var.description + name = coalesce(var.https_proxy_config.name, var.name) + description = var.http_proxy_config.description url_map = google_compute_region_url_map.default.id } diff --git a/modules/net-lb-app-int/variables.tf b/modules/net-lb-app-int/variables.tf index a81e5853d..26a505855 100644 --- a/modules/net-lb-app-int/variables.tf +++ b/modules/net-lb-app-int/variables.tf @@ -36,6 +36,8 @@ variable "global_access" { variable "group_configs" { description = "Optional unmanaged groups to create. Can be referenced in backends via key or outputs." type = map(object({ + name = optional(string) + description = optional(string, "Terraform managed.") zone = string instances = optional(list(string)) named_ports = optional(map(number), {}) @@ -45,6 +47,16 @@ variable "group_configs" { nullable = false } +variable "http_proxy_config" { + description = "HTTP proxy configuration. Only used for non-classic load balancers." + type = object({ + name = optional(string) + description = optional(string, "Terraform managed.") + }) + default = {} + nullable = false +} + variable "https_proxy_config" { description = "HTTPS proxy configuration." type = object({ diff --git a/modules/net-lb-ext/README.md b/modules/net-lb-ext/README.md index 428b5ac84..998cf65a2 100644 --- a/modules/net-lb-ext/README.md +++ b/modules/net-lb-ext/README.md @@ -202,17 +202,16 @@ For deploying changes to load balancer configuration please refer to [net-lb-app | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L202) | Name used for all resources. | string | ✓ | | -| [project_id](variables.tf#L207) | Project id where resources will be created. | string | ✓ | | -| [region](variables.tf#L212) | GCP region. | string | ✓ | | +| [name](variables.tf#L198) | Name used for all resources. | string | ✓ | | +| [project_id](variables.tf#L203) | Project id where resources will be created. | string | ✓ | | +| [region](variables.tf#L208) | GCP region. | string | ✓ | | | [backend_service_config](variables.tf#L17) | Backend service level configuration. | object({…}) | | {} | | [backends](variables.tf#L68) | Load balancer backends. | list(object({…})) | | [] | -| [description](variables.tf#L79) | Optional description used for resources. | string | | "Terraform managed." | -| [forwarding_rules_config](variables.tf#L85) | The optional forwarding rules configuration. | map(object({…})) | | {…} | -| [group_configs](variables.tf#L101) | Optional unmanaged groups to create. Can be referenced in backends via outputs. | map(object({…})) | | {} | -| [health_check](variables.tf#L112) | Name of existing health check to use, disables auto-created health check. | string | | null | -| [health_check_config](variables.tf#L118) | Optional auto-created health check configuration, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | {…} | -| [labels](variables.tf#L196) | Labels set on resources. | map(string) | | {} | +| [forwarding_rules_config](variables.tf#L79) | The optional forwarding rules configuration. | map(object({…})) | | {…} | +| [group_configs](variables.tf#L95) | Optional unmanaged groups to create. Can be referenced in backends via outputs. | map(object({…})) | | {} | +| [health_check](variables.tf#L108) | Name of existing health check to use, disables auto-created health check. | string | | null | +| [health_check_config](variables.tf#L114) | Optional auto-created health check configuration, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | {…} | +| [labels](variables.tf#L192) | Labels set on resources. | map(string) | | {} | ## Outputs diff --git a/modules/net-lb-ext/groups.tf b/modules/net-lb-ext/groups.tf index 3389fb17d..a43445989 100644 --- a/modules/net-lb-ext/groups.tf +++ b/modules/net-lb-ext/groups.tf @@ -20,8 +20,8 @@ resource "google_compute_instance_group" "default" { for_each = var.group_configs project = var.project_id zone = each.value.zone - name = "${var.name}-${each.key}" - description = var.description + name = coalesce(each.value.name, "${var.name}-${each.key}") + description = each.value.description instances = each.value.instances dynamic "named_port" { diff --git a/modules/net-lb-ext/variables.tf b/modules/net-lb-ext/variables.tf index a62b0eb39..521e1390b 100644 --- a/modules/net-lb-ext/variables.tf +++ b/modules/net-lb-ext/variables.tf @@ -76,12 +76,6 @@ variable "backends" { nullable = false } -variable "description" { - description = "Optional description used for resources." - type = string - default = "Terraform managed." -} - variable "forwarding_rules_config" { description = "The optional forwarding rules configuration." type = map(object({ @@ -101,6 +95,8 @@ variable "forwarding_rules_config" { variable "group_configs" { description = "Optional unmanaged groups to create. Can be referenced in backends via outputs." type = map(object({ + name = optional(string) + description = optional(string, "Terraform managed.") zone = string instances = optional(list(string)) named_ports = optional(map(number), {}) diff --git a/modules/net-lb-int/README.md b/modules/net-lb-int/README.md index 19fcca8cb..3551c1a7d 100644 --- a/modules/net-lb-int/README.md +++ b/modules/net-lb-int/README.md @@ -374,21 +374,21 @@ One other issue is a `Provider produced inconsistent final plan` error which is | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L201) | Name used for all resources. | string | ✓ | | -| [project_id](variables.tf#L206) | Project id where resources will be created. | string | ✓ | | -| [region](variables.tf#L211) | GCP region. | string | ✓ | | -| [vpc_config](variables.tf#L237) | VPC-level configuration. | object({…}) | ✓ | | +| [name](variables.tf#L202) | Name used for all resources. | string | ✓ | | +| [project_id](variables.tf#L207) | Project id where resources will be created. | string | ✓ | | +| [region](variables.tf#L212) | GCP region. | string | ✓ | | +| [vpc_config](variables.tf#L238) | VPC-level configuration. | object({…}) | ✓ | | | [backend_service_config](variables.tf#L17) | Backend service level configuration. | object({…}) | | {} | | [backends](variables.tf#L53) | Load balancer backends. | list(object({…})) | | [] | | [context](variables.tf#L64) | Context-specific interpolations. | object({…}) | | {} | | [description](variables.tf#L77) | Optional description used for resources. | string | | "Terraform managed." | | [forwarding_rules_config](variables.tf#L83) | The optional forwarding rules configuration. | map(object({…})) | | {…} | -| [group_configs](variables.tf#L99) | Optional unmanaged groups to create. Can be referenced in backends via outputs. | map(object({…})) | | {} | -| [health_check](variables.tf#L111) | Name of existing health check to use, disables auto-created health check. Also set `health_check_config = null` when cross-referencing an health check from another load balancer module to avoid a Terraform error. | string | | null | -| [health_check_config](variables.tf#L117) | Optional auto-created health check configuration, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | {…} | -| [labels](variables.tf#L195) | Labels set on resources. | map(string) | | {} | -| [service_attachments](variables.tf#L216) | PSC service attachments, keyed by forwarding rule. | map(object({…})) | | null | -| [service_label](variables.tf#L231) | Optional prefix of the fully qualified forwarding rule name. | string | | null | +| [group_configs](variables.tf#L99) | Optional unmanaged groups to create. Can be referenced in backends via outputs. | map(object({…})) | | {} | +| [health_check](variables.tf#L112) | Name of existing health check to use, disables auto-created health check. Also set `health_check_config = null` when cross-referencing an health check from another load balancer module to avoid a Terraform error. | string | | null | +| [health_check_config](variables.tf#L118) | Optional auto-created health check configuration, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | {…} | +| [labels](variables.tf#L196) | Labels set on resources. | map(string) | | {} | +| [service_attachments](variables.tf#L217) | PSC service attachments, keyed by forwarding rule. | map(object({…})) | | null | +| [service_label](variables.tf#L232) | Optional prefix of the fully qualified forwarding rule name. | string | | null | ## Outputs diff --git a/modules/net-lb-int/groups.tf b/modules/net-lb-int/groups.tf index 3492f5b3d..aa577a0db 100644 --- a/modules/net-lb-int/groups.tf +++ b/modules/net-lb-int/groups.tf @@ -20,7 +20,7 @@ resource "google_compute_instance_group" "default" { for_each = var.group_configs project = local.project_id zone = lookup(local.ctx.locations, each.value.zone, each.value.zone) - name = "${var.name}-${each.key}" + name = coalesce(each.value.name, "${var.name}-${each.key}") description = each.value.description instances = each.value.instances diff --git a/modules/net-lb-int/variables.tf b/modules/net-lb-int/variables.tf index 5b023581f..a897b0408 100644 --- a/modules/net-lb-int/variables.tf +++ b/modules/net-lb-int/variables.tf @@ -100,6 +100,7 @@ variable "group_configs" { description = "Optional unmanaged groups to create. Can be referenced in backends via outputs." type = map(object({ zone = string + name = optional(string) description = optional(string, "Terraform managed.") instances = optional(list(string)) named_ports = optional(map(number), {}) diff --git a/modules/net-lb-proxy-int/README.md b/modules/net-lb-proxy-int/README.md index 95e298385..5ba2d513b 100644 --- a/modules/net-lb-proxy-int/README.md +++ b/modules/net-lb-proxy-int/README.md @@ -334,21 +334,21 @@ For deploying changes to load balancer configuration please refer to [net-lb-app | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L201) | Load balancer name. | string | ✓ | | -| [project_id](variables.tf#L270) | Project id. | string | ✓ | | -| [region](variables.tf#L275) | The region where to allocate the ILB resources. | string | ✓ | | -| [vpc_config](variables.tf#L295) | VPC-level configuration. | object({…}) | ✓ | | +| [name](variables.tf#L203) | Load balancer name. | string | ✓ | | +| [project_id](variables.tf#L272) | Project id. | string | ✓ | | +| [region](variables.tf#L277) | The region where to allocate the ILB resources. | string | ✓ | | +| [vpc_config](variables.tf#L297) | VPC-level configuration. | object({…}) | ✓ | | | [address](variables.tf#L17) | Optional IP address used for the forwarding rule. | string | | null | | [backend_service_config](variables.tf#L23) | Backend service level configuration. | object({…}) | | {} | | [description](variables.tf#L77) | Optional description used for resources. | string | | "Terraform managed." | | [global_access](variables.tf#L84) | Allow client access from all regions. | bool | | null | -| [group_configs](variables.tf#L90) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | -| [health_check](variables.tf#L102) | Name of existing health check to use, disables auto-created health check. | string | | null | -| [health_check_config](variables.tf#L108) | Optional auto-created health check configurations, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | {…} | -| [labels](variables.tf#L195) | Labels set on resources. | map(string) | | {} | -| [neg_configs](variables.tf#L206) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | -| [port](variables.tf#L264) | Port. | number | | 80 | -| [service_attachment](variables.tf#L280) | PSC service attachment. | object({…}) | | null | +| [group_configs](variables.tf#L90) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [health_check](variables.tf#L104) | Name of existing health check to use, disables auto-created health check. | string | | null | +| [health_check_config](variables.tf#L110) | Optional auto-created health check configurations, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | {…} | +| [labels](variables.tf#L197) | Labels set on resources. | map(string) | | {} | +| [neg_configs](variables.tf#L208) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | map(object({…})) | | {} | +| [port](variables.tf#L266) | Port. | number | | 80 | +| [service_attachment](variables.tf#L282) | PSC service attachment. | object({…}) | | null | ## Outputs diff --git a/modules/net-lb-proxy-int/groups.tf b/modules/net-lb-proxy-int/groups.tf index 53ba6b27f..c280e7ae9 100644 --- a/modules/net-lb-proxy-int/groups.tf +++ b/modules/net-lb-proxy-int/groups.tf @@ -22,8 +22,8 @@ resource "google_compute_instance_group" "default" { : each.value.project_id ) zone = each.value.zone - name = "${var.name}-${each.key}" - description = var.description + name = coalesce(each.value.name, "${var.name}-${each.key}") + description = each.value.description instances = each.value.instances dynamic "named_port" { diff --git a/modules/net-lb-proxy-int/variables.tf b/modules/net-lb-proxy-int/variables.tf index 4e8db0b05..2f888469d 100644 --- a/modules/net-lb-proxy-int/variables.tf +++ b/modules/net-lb-proxy-int/variables.tf @@ -90,6 +90,8 @@ variable "global_access" { variable "group_configs" { description = "Optional unmanaged groups to create. Can be referenced in backends via key or outputs." type = map(object({ + name = optional(string) + description = optional(string, "Terraform managed.") zone = string instances = optional(list(string)) named_ports = optional(map(number), {})