'TCP vs HTTP health_check with terraform-google-lb
I am using the terraform-google-lb (https://github.com/terraform-google-modules) module to create an http-https redirect with multiple backends. The module works great and all my backends and http redirect work. For whatever reason, the HTTP health_checks that the module creates will not work in my environment. When I change them manually to TCP health_checks, the health checks work. It looks like the module is hardcoded to create HTTP health_checks. Can this be changed to TCP health_checks with different TF code? The only way I can get this working so far is to delete the backend service (manually) and re-create it with a TCP health_check, which obviously subverts the automation considerably. The module uses this code (below) in main.tf , which apparently calls back into the module somewhwere and creates an HTTP hc. I would like to continue using the module because it streamlines many components that I would have to create piecemeal. But for the health_check, everything else works great.
locals {
health_check = {
check_interval_sec = "5"
timeout_sec = "5"
healthy_threshold = "2"
unhealthy_threshold = "2"
request_path = "/"
port = 80
host = null
logging = null
}
inside the module the locals is referenced to the create the hc:
backends = {
default = {
description = null
protocol = "HTTP"
port = 80
port_name = "http"
timeout_sec = 10
connection_draining_timeout_sec = null
enable_cdn = false
security_policy = null
session_affinity = null
affinity_cookie_ttl_sec = null
custom_request_headers = null
custom_response_headers = null
health_check = local.health_check
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
