1616
1717
1818locals {
19- address = var.create_address ? join("", google_compute_global_address.default.* .address) : var.address
20- ipv6_address = var.create_ipv6_address ? join("", google_compute_global_address.default_ipv6.* .address) : var.ipv6_address
19+ address = var.create_address ? join("", google_compute_global_address.default[*] .address) : var.address
20+ ipv6_address = var.create_ipv6_address ? join("", google_compute_global_address.default_ipv6[*] .address) : var.ipv6_address
2121
22- url_map = var.create_url_map ? join("", google_compute_url_map.default.* .self_link) : var.url_map
22+ url_map = var.create_url_map ? join("", google_compute_url_map.default[*] .self_link) : var.url_map
2323 create_http_forward = var.http_forward || var.https_redirect
2424
2525 {% if not serverless %}{# Serverless NEGs don't support health checks #}
@@ -109,7 +109,7 @@ resource "google_compute_target_http_proxy" "default" {
109109 project = var.project
110110 count = local.create_http_forward ? 1 : 0
111111 name = "${var.name}-http-proxy"
112- url_map = var.https_redirect == false ? local.url_map : join("", google_compute_url_map.https_redirect.* .self_link)
112+ url_map = var.https_redirect == false ? local.url_map : join("", google_compute_url_map.https_redirect[*] .self_link)
113113}
114114
115115# HTTPS proxy when ssl is true
@@ -119,7 +119,7 @@ resource "google_compute_target_https_proxy" "default" {
119119 name = "${var.name}-https-proxy"
120120 url_map = local.url_map
121121
122- ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default.* .self_link, google_compute_managed_ssl_certificate.default.* .self_link, ), )
122+ ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*] .self_link, google_compute_managed_ssl_certificate.default[*] .self_link, ), )
123123 certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
124124 ssl_policy = var.ssl_policy
125125 quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
@@ -213,27 +213,27 @@ resource "google_compute_backend_service" "default" {
213213 {% endif %}
214214
215215 # To achieve a null backend edge_security_policy, set each.value.edge_security_policy to "" (empty string), otherwise, it fallsback to var.edge_security_policy.
216- edge_security_policy = lookup( each.value, "edge_security_policy") == "" ? null : (lookup( each.value, "edge_security_policy") == null ? var.edge_security_policy : each.value.edge_security_policy)
216+ edge_security_policy = each.value[ "edge_security_policy"] == "" ? null : (each.value[ "edge_security_policy"] == null ? var.edge_security_policy : each.value.edge_security_policy)
217217
218218 # To achieve a null backend security_policy, set each.value.security_policy to "" (empty string), otherwise, it fallsback to var.security_policy.
219- security_policy = lookup( each.value, "security_policy") == "" ? null : (lookup( each.value, "security_policy") == null ? var.security_policy : each.value.security_policy)
219+ security_policy = each.value[ "security_policy"] == "" ? null : (each.value[ "security_policy"] == null ? var.security_policy : each.value.security_policy)
220220
221221 dynamic "backend" {
222222 for_each = toset(each.value["groups"])
223223 content {
224224 description = lookup(backend.value, "description", null)
225- group = lookup( backend.value, "group")
225+ group = backend.value[ "group"]
226226
227227 {% if not serverless %}{# doesn't apply to serverless NEGs #}
228- balancing_mode = lookup( backend.value, "balancing_mode")
229- capacity_scaler = lookup( backend.value, "capacity_scaler")
230- max_connections = lookup( backend.value, "max_connections")
231- max_connections_per_instance = lookup( backend.value, "max_connections_per_instance")
232- max_connections_per_endpoint = lookup( backend.value, "max_connections_per_endpoint")
233- max_rate = lookup( backend.value, "max_rate")
234- max_rate_per_instance = lookup( backend.value, "max_rate_per_instance")
235- max_rate_per_endpoint = lookup( backend.value, "max_rate_per_endpoint")
236- max_utilization = lookup( backend.value, "max_utilization")
228+ balancing_mode = backend.value[ "balancing_mode"]
229+ capacity_scaler = backend.value[ "capacity_scaler"]
230+ max_connections = backend.value[ "max_connections"]
231+ max_connections_per_instance = backend.value[ "max_connections_per_instance"]
232+ max_connections_per_endpoint = backend.value[ "max_connections_per_endpoint"]
233+ max_rate = backend.value[ "max_rate"]
234+ max_rate_per_instance = backend.value[ "max_rate_per_instance"]
235+ max_rate_per_endpoint = backend.value[ "max_rate_per_endpoint"]
236+ max_utilization = backend.value[ "max_utilization"]
237237 {% endif %}
238238 }
239239 }
@@ -296,7 +296,7 @@ resource "google_compute_backend_service" "default" {
296296 }
297297
298298 dynamic "outlier_detection" {
299- for_each = each.value.outlier_detection != null && ( var.load_balancing_scheme == "INTERNAL_SELF_MANAGED" || var.load_balancing_scheme == "EXTERNAL_MANAGED" ) ? [1] : []
299+ for_each = each.value.outlier_detection != null && (var.load_balancing_scheme == "INTERNAL_SELF_MANAGED" || var.load_balancing_scheme == "EXTERNAL_MANAGED" ) ? [1] : []
300300 content {
301301 consecutive_errors = each.value.outlier_detection.consecutive_errors
302302 consecutive_gateway_failure = each.value.outlier_detection.consecutive_gateway_failure
@@ -358,24 +358,24 @@ resource "google_compute_health_check" "default" {
358358 dynamic "http_health_check" {
359359 for_each = coalesce(lookup(each.value["health_check"], "protocol", null), each.value["protocol"]) == "HTTP" ? [
360360 {
361- host = lookup(each.value["health_check"], "host", null)
362- request_path = lookup(each.value["health_check"], "request_path", null)
363- response = lookup(each.value["health_check"], "response", null)
364- port = lookup(each.value["health_check"], "port", null)
365- port_name = lookup(each.value["health_check"], "port_name", null)
366- proxy_header = lookup(each.value["health_check"], "proxy_header", null)
367- port_specification = lookup(each.value["health_check"], "port_specification", null)
361+ host = lookup(each.value["health_check"], "host", null)
362+ request_path = lookup(each.value["health_check"], "request_path", null)
363+ response = lookup(each.value["health_check"], "response", null)
364+ port = lookup(each.value["health_check"], "port", null)
365+ port_name = lookup(each.value["health_check"], "port_name", null)
366+ proxy_header = lookup(each.value["health_check"], "proxy_header", null)
367+ port_specification = lookup(each.value["health_check"], "port_specification", null)
368368 }
369369 ] : []
370370
371371 content {
372- host = lookup(http_health_check.value, "host", null)
373- request_path = lookup(http_health_check.value, "request_path", null)
374- response = lookup(http_health_check.value, "response", null)
375- port = lookup(http_health_check.value, "port", null)
376- port_name = lookup(http_health_check.value, "port_name", null)
377- proxy_header = lookup(http_health_check.value, "proxy_header", null)
378- port_specification = lookup(http_health_check.value, "port_specification", null)
372+ host = lookup(http_health_check.value, "host", null)
373+ request_path = lookup(http_health_check.value, "request_path", null)
374+ response = lookup(http_health_check.value, "response", null)
375+ port = lookup(http_health_check.value, "port", null)
376+ port_name = lookup(http_health_check.value, "port_name", null)
377+ proxy_header = lookup(http_health_check.value, "proxy_header", null)
378+ port_specification = lookup(http_health_check.value, "port_specification", null)
379379 }
380380 }
381381
@@ -393,59 +393,59 @@ resource "google_compute_health_check" "default" {
393393 ] : []
394394
395395 content {
396- host = lookup(https_health_check.value, "host", null)
397- request_path = lookup(https_health_check.value, "request_path", null)
398- response = lookup(https_health_check.value, "response", null)
399- port = lookup(https_health_check.value, "port", null)
400- port_name = lookup(https_health_check.value, "port_name", null)
401- proxy_header = lookup(https_health_check.value, "proxy_header", null)
402- port_specification = lookup(https_health_check.value, "port_specification", null)
396+ host = lookup(https_health_check.value, "host", null)
397+ request_path = lookup(https_health_check.value, "request_path", null)
398+ response = lookup(https_health_check.value, "response", null)
399+ port = lookup(https_health_check.value, "port", null)
400+ port_name = lookup(https_health_check.value, "port_name", null)
401+ proxy_header = lookup(https_health_check.value, "proxy_header", null)
402+ port_specification = lookup(https_health_check.value, "port_specification", null)
403403 }
404404 }
405405
406406 dynamic "http2_health_check" {
407407 for_each = coalesce(lookup(each.value["health_check"], "protocol", null), each.value["protocol"]) == "HTTP2" ? [
408408 {
409- host = lookup(each.value["health_check"], "host", null)
410- request_path = lookup(each.value["health_check"], "request_path", null)
411- response = lookup(each.value["health_check"], "response", null)
412- port = lookup(each.value["health_check"], "port", null)
413- port_name = lookup(each.value["health_check"], "port_name", null)
414- proxy_header = lookup(each.value["health_check"], "proxy_header", null)
415- port_specification = lookup(each.value["health_check"], "port_specification", null)
409+ host = lookup(each.value["health_check"], "host", null)
410+ request_path = lookup(each.value["health_check"], "request_path", null)
411+ response = lookup(each.value["health_check"], "response", null)
412+ port = lookup(each.value["health_check"], "port", null)
413+ port_name = lookup(each.value["health_check"], "port_name", null)
414+ proxy_header = lookup(each.value["health_check"], "proxy_header", null)
415+ port_specification = lookup(each.value["health_check"], "port_specification", null)
416416 }
417417 ] : []
418418
419419 content {
420- host = lookup(http2_health_check.value, "host", null)
421- request_path = lookup(http2_health_check.value, "request_path", null)
422- response = lookup(http2_health_check.value, "response", null)
423- port = lookup(http2_health_check.value, "port", null)
424- port_name = lookup(http2_health_check.value, "port_name", null)
425- proxy_header = lookup(http2_health_check.value, "proxy_header", null)
426- port_specification = lookup(http2_health_check.value, "port_specification", null)
420+ host = lookup(http2_health_check.value, "host", null)
421+ request_path = lookup(http2_health_check.value, "request_path", null)
422+ response = lookup(http2_health_check.value, "response", null)
423+ port = lookup(http2_health_check.value, "port", null)
424+ port_name = lookup(http2_health_check.value, "port_name", null)
425+ proxy_header = lookup(http2_health_check.value, "proxy_header", null)
426+ port_specification = lookup(http2_health_check.value, "port_specification", null)
427427 }
428428 }
429429
430430 dynamic "tcp_health_check" {
431431 for_each = coalesce(lookup(each.value["health_check"], "protocol", null), each.value["protocol"]) == "TCP" ? [
432432 {
433- request = lookup(each.value["health_check"], "request", null)
434- response = lookup(each.value["health_check"], "response", null)
435- port = lookup(each.value["health_check"], "port", null)
436- port_name = lookup(each.value["health_check"], "port_name", null)
437- proxy_header = lookup(each.value["health_check"], "proxy_header", null)
438- port_specification = lookup(each.value["health_check"], "port_specification", null)
433+ request = lookup(each.value["health_check"], "request", null)
434+ response = lookup(each.value["health_check"], "response", null)
435+ port = lookup(each.value["health_check"], "port", null)
436+ port_name = lookup(each.value["health_check"], "port_name", null)
437+ proxy_header = lookup(each.value["health_check"], "proxy_header", null)
438+ port_specification = lookup(each.value["health_check"], "port_specification", null)
439439 }
440440 ] : []
441441
442442 content {
443- request = lookup(tcp_health_check.value, "request", null)
444- response = lookup(tcp_health_check.value, "response", null)
445- port = lookup(tcp_health_check.value, "port", null)
446- port_name = lookup(tcp_health_check.value, "port_name", null)
447- proxy_header = lookup(tcp_health_check.value, "proxy_header", null)
448- port_specification = lookup(tcp_health_check.value, "port_specification", null)
443+ request = lookup(tcp_health_check.value, "request", null)
444+ response = lookup(tcp_health_check.value, "response", null)
445+ port = lookup(tcp_health_check.value, "port", null)
446+ port_name = lookup(tcp_health_check.value, "port_name", null)
447+ proxy_header = lookup(tcp_health_check.value, "proxy_header", null)
448+ port_specification = lookup(tcp_health_check.value, "port_specification", null)
449449 }
450450 }
451451}
0 commit comments