From fd472596cb10c47552c24d0d7754760204927e08 Mon Sep 17 00:00:00 2001 From: ramonskie Date: Thu, 19 Nov 2026 20:15:35 +0100 Subject: [PATCH] fix(aws): restore HTTP health check on concourse LB The AWS provider now rejects a TCP health check that still carries a non-empty matcher or path: Attribute "health_check[0].matcher" cannot be specified when "health_check[0].protocol" is "TCP". bbl's concourse_lb_80 target group was HTTP, then deliberately switched to TCP in d2ab1d97 ("Use network load balancers for AWS Concourse LBs"), the follow-up to the 2017 classic-ELB -> NLB migration (65dac071, issue #228). In 65dac071 the health_check block omitted `protocol`, and the AWS provider at the time defaulted health_check.protocol to "HTTP", so the target group was created with an HTTP check (path "/", matcher "200-399"). d2ab1d97 then set protocol = "TCP" and dropped path/matcher. The commit records no health-check rationale; the 2017 constraints made TCP the pragmatic choice. NLB health checks could not configure a matcher (fixed at 200-399) or a timeout (removed in 3e3eed87), and Terraform's NLB support had only just been fixed. TCP also matched the pre-migration classic ELB check (target = "TCP:8080"). TCP itself is not the problem: `path` and `matcher` are Optional + Computed, so environments whose target groups were created while the check was HTTP kept the old values in AWS and in state. Removing them from the template never cleared them, and provider v3.75.0+ now fails the plan on TCP + non-empty matcher/path (CustomizeDiff in resourceTargetGroupCustomizeDiff). Upstream: hashicorp/terraform-provider-aws#8305. Restore the HTTP health check. NLB already listed HTTP/HTTPS/TCP as health-check protocols in 2017, and since the November 2022 health-check improvements it also allows a configurable matcher range (200-599), so the constraints behind the 2017 switch no longer apply. Setting path and matcher explicitly also overwrites the inherited values, so long-lived environments converge on the next apply. matcher 200-499 is within the NLB-valid range and is the value verified in the issue: 4xx counts as healthy while 5xx still marks a target unhealthy. Fresh environments are unaffected; this stays a network load balancer and only changes the health check on the port-80 target group. Fixes: #701 --- terraform/aws/templates/concourse_lb.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/terraform/aws/templates/concourse_lb.tf b/terraform/aws/templates/concourse_lb.tf index f72597528..169a48b62 100644 --- a/terraform/aws/templates/concourse_lb.tf +++ b/terraform/aws/templates/concourse_lb.tf @@ -83,11 +83,16 @@ resource "aws_lb_target_group" "concourse_lb_80" { protocol = "TCP" vpc_id = local.vpc_id + # HTTP health check rather than TCP. NLB has supported HTTP health checks + # since launch; this also clears the stale path/matcher values that + # environments created while this check was HTTP inherited (see issue #701). health_check { healthy_threshold = 10 unhealthy_threshold = 10 interval = 30 - protocol = "TCP" + protocol = "HTTP" + path = "/" + matcher = "200-499" } tags = {