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:
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
@@ -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" {
|
||||
|
||||
@@ -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" {
|
||||
|
||||
@@ -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), {})
|
||||
|
||||
Reference in New Issue
Block a user