It is desirable to be able to configure either a TCP or HTTP/HTTPS health check based on variables as in the below example. Currently the validation forces the health check path to begin with a slash("/"), even when the protocol is TCP, preventing this use case. When the protocol is TCP, blank ("") is the only valid path for the AWS API.
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 10
port = 8000
path = "${var.protocol == "TCP" ? "" : "/healthz"}"
protocol = "${var.protocol}"
interval = 30
matcher = "${var.protocol == "TCP" ? "" : "200-399"}"
}
Terraform v0.11.1
+ provider.aws v1.7.0
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 10
port = 8000
path = ""
protocol = "TCP"
interval = 30
matcher = ""
}
Expected to be able to use a blank 'path' for a TCP health check.
Or else the path validation should be left to the AWS API.
Error: module.nlb.aws_lb_target_group.nlb[0]: "health_check.0.path" must begin with a '/' character: ""
aws_lb_target_group with health_check.protocol="TCP" and health_check.path=""terraform initterraform applyValidation was recently improved to enable HTTP/HTTPS health checks to be able to be specified for TCP Target Groups in PR #2906.
Looks like there is a fairly trivial fix for this: PR #2980
Only check for "/" if the path is not blank.
This fix is in master and will be released in v1.7.1, which we are planning for later this week.
This has been released in terraform-provider-aws version 1.7.1. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
This has been released in terraform-provider-aws version 1.7.1. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.