Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ This module creates `google_compute_backend_service` resource and its dependenci
| firewall\_projects | Names of the projects to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
| firewall\_source\_ranges | Source ranges for the global Application Load Balancer's proxies. This list should contain the `ip_cidr_range` of each GLOBAL\_MANAGED\_PROXY subnet. | `list(string)` | <pre>[<br> "10.127.0.0/23"<br>]</pre> | no |
| groups | The list of backend instance group which serves the traffic. | <pre>list(object({<br> group = string<br> description = optional(string)<br><br> balancing_mode = optional(string)<br> capacity_scaler = optional(number)<br> max_connections = optional(number)<br> max_connections_per_instance = optional(number)<br> max_connections_per_endpoint = optional(number)<br> max_rate = optional(number)<br> max_rate_per_instance = optional(number)<br> max_rate_per_endpoint = optional(number)<br> max_utilization = optional(number)<br> }))</pre> | `[]` | no |
| health\_check | Input for creating HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. A health check must be specified unless the backend service uses an internet or serverless NEG as a backend. | <pre>object({<br> host = optional(string, null)<br> request_path = optional(string, null)<br> request = optional(string, null)<br> response = optional(string, null)<br> port = optional(number, null)<br> port_name = optional(string, null)<br> proxy_header = optional(string, null)<br> port_specification = optional(string, null)<br> protocol = optional(string, null)<br> check_interval_sec = optional(number, 5)<br> timeout_sec = optional(number, 5)<br> healthy_threshold = optional(number, 2)<br> unhealthy_threshold = optional(number, 2)<br> logging = optional(bool, false)<br> })</pre> | `null` | no |
| health\_check | Input for creating HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Either `health\_check` or `health\_check\_self\_link` must be specidied unless the backend service uses an internet or serverless NEG as a backend. | <pre>object({<br> host = optional(string, null)<br> request_path = optional(string, null)<br> request = optional(string, null)<br> response = optional(string, null)<br> port = optional(number, null)<br> port_name = optional(string, null)<br> proxy_header = optional(string, null)<br> port_specification = optional(string, null)<br> protocol = optional(string, null)<br> check_interval_sec = optional(number, 5)<br> timeout_sec = optional(number, 5)<br> healthy_threshold = optional(number, 2)<br> unhealthy_threshold = optional(number, 2)<br> logging = optional(bool, false)<br> })</pre> | `null` | no |
| health\_check\_self\_link | Self link of an existing health check. Either `health\_check` or `health\_check\_self\_link` must be specidied unless the backend service uses an internet or serverless NEG as a backend. | `string` | `null` | no |
| host\_path\_mappings | The list of host/path for which traffic could be sent to the backend service | <pre>list(object({<br> host = string<br> path = string<br> }))</pre> | <pre>[<br> {<br> "host": "*",<br> "path": "/*"<br> }<br>]</pre> | no |
| iap\_config | Settings for enabling Cloud Identity Aware Proxy Structure. | <pre>object({<br> enable = bool<br> oauth2_client_id = optional(string)<br> oauth2_client_secret = optional(string)<br> })</pre> | <pre>{<br> "enable": false<br>}</pre> | no |
| load\_balancing\_scheme | Load balancing scheme type (EXTERNAL for classic external load balancer, EXTERNAL\_MANAGED for Envoy-based load balancer, INTERNAL\_MANAGED for internal load balancer and INTERNAL\_SELF\_MANAGED for traffic director) | `string` | `"EXTERNAL_MANAGED"` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/backend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource "google_compute_backend_service" "default" {
security_policy = var.security_policy
timeout_sec = var.timeout_sec

health_checks = var.health_check != null ? google_compute_health_check.default[*].self_link : null
health_checks = var.health_check != null ? google_compute_health_check.default[*].self_link : ( var.health_check_self_link != null ? [var.health_check_self_link] : [] )

dynamic "backend" {
for_each = toset(var.groups)
Expand Down
8 changes: 7 additions & 1 deletion modules/backend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ variable "outlier_detection" {
}

variable "health_check" {
description = "Input for creating HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. A health check must be specified unless the backend service uses an internet or serverless NEG as a backend."
description = "Input for creating HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Either health_check or health_check_self_link must be specidied unless the backend service uses an internet or serverless NEG as a backend."
type = object({
host = optional(string, null)
request_path = optional(string, null)
Expand All @@ -242,6 +242,12 @@ variable "health_check" {
default = null
}

variable "health_check_self_link" {
description = "Self link of an existing health check. Either health_check or health_check_self_link must be specidied unless the backend service uses an internet or serverless NEG as a backend."
type = string
default = null
}

variable "edge_security_policy" {
description = "The resource URL for the edge security policy to associate with the backend service"
type = string
Expand Down