improve configurability and resource references for internal ALB (#3654)

* refactor(net-lb-app-ext): improve configurability and resource references

- Allow overriding names for backend buckets and instance groups
- Add optional per-group description with default value
- Use self_link for instance group backend references
- Fix HTTP proxy name to use http_proxy_config

* reverted the instance group reference in backend service back to id instead of self link

* updated all the lb modules for unmanaged instance groups to have flexible names and proper refactorization of http_proxy_cofig in each module

* removed the description variable

* updated the readme.md for the net-lb-app-ext-regional module

* fixed the linting error for the change in versions.tf

---------

Co-authored-by: Julio Castillo <jccb@google.com>
Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
This commit is contained in:
Suryansh Singhal
2026-01-23 21:05:52 +05:30
committed by GitHub
parent b18a883506
commit f94033f098
26 changed files with 145 additions and 114 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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

View File

@@ -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" {

View File

@@ -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" {

View File

@@ -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), {})