-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealth_check.tf
31 lines (29 loc) · 1.5 KB
/
health_check.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
resource "google_compute_health_check" "cn_lb" {
for_each = local.negs
name = "health-check-${each.key}-${local.random_suffix}"
timeout_sec = each.value.timeout_sec == null ? var.timeout_sec : each.value.timeout_sec
check_interval_sec = each.value.check_interval_sec == null ? var.check_interval_sec : each.value.check_interval_sec
healthy_threshold = each.value.healthy_threshold == null ? var.healthy_threshold : each.value.healthy_threshold
unhealthy_threshold = each.value.unhealthy_threshold == null ? var.unhealthy_threshold : each.value.unhealthy_threshold
dynamic "http_health_check" {
for_each = each.value.http_backend_protocol == null ? [1] : []
content {
port_specification = "USE_SERVING_PORT"
request_path = each.value.health_check_request_path == null ? var.health_check_request_path : each.value.health_check_request_path
}
}
dynamic "http2_health_check" {
for_each = each.value.http_backend_protocol == "HTTP2" ? [1] : []
content {
port_specification = "USE_SERVING_PORT"
request_path = each.value.health_check_request_path == null ? var.health_check_request_path : each.value.health_check_request_path
}
}
dynamic "https_health_check" {
for_each = each.value.http_backend_protocol == "HTTPS" ? [1] : []
content {
port_specification = "USE_SERVING_PORT"
request_path = each.value.health_check_request_path == null ? var.health_check_request_path : each.value.health_check_request_path
}
}
}