Repository navigation
fix(aws): restore HTTP health check on concourse LB - #704
Conversation
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 d2ab1d9 ("Use network load balancers for AWS Concourse LBs"), the follow-up to the 2017 classic-ELB -> NLB migration (65dac07, issue #228). In 65dac07 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"). d2ab1d9 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 3e3eed8), 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
|
No actionable comments were generated in the recent review. WalkthroughThe port 80 target group health check now uses HTTP on Suggested reviewers: Severity of issue fixed: Medium Merge Risk:
|
Summary
Fixes #701.
bbl up --lb-type concourseon AWS currently fails duringterraform planwith:This restores the HTTP health check on the
concourse_lb_80target group, with an explicitpathandmatcher.Why this is failing
bbl'sconcourse_lb_80target group was HTTP, then deliberately switched to TCP ind2ab1d97("Use network load balancers for AWS Concourse LBs"), the follow-up to the 2017 classic-ELB → NLB migration (65dac071, issue #228).In
65dac071thehealth_checkblock omittedprotocol, and the AWS provider at the time defaultedhealth_check.protocoltoHTTP, so the target group was created with an HTTP check (path = "/",matcher = "200-399").d2ab1d97then setprotocol = "TCP"and droppedpath/matcher.The commit records no health-check-specific rationale; the 2017 constraints made TCP the pragmatic choice:
matcher(fixed at 200–399) or atimeout(removed in3e3eed87).target = "TCP:8080").TCP itself is not the problem.
pathandmatcherareOptional+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-emptymatcher/path(CustomizeDiff inresourceTargetGroupCustomizeDiff). See hashicorp/terraform-provider-aws#8305.Why HTTP is safe now
pathandmatcherexplicitly 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; only the health check on the port-80 target group changes.
Testing
go test ./terraform/aws/...✅ci/pipelines/bosh-bootloader.yml, andterraform validatewould not catch this anyway — the CustomizeDiff only runs duringplanagainst real credentials.