Skip to content

Commit 53eb9e1

Browse files
Merge pull request #18 from mbolek/tg_health_code
Adding the health check code for ALB health checking
2 parents 46bd6b5 + 36affa2 commit 53eb9e1

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ resource "aws_alb_target_group" "target_group" {
6060
unhealthy_threshold = "${var.health_check_unhealthy_threshold}"
6161
timeout = "${var.health_check_timeout}"
6262
protocol = "${var.backend_protocol}"
63+
matcher = "${var.health_check_code}"
6364
}
6465

6566
stickiness {

test/integration/default/local_alb.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
its(:health_check_path) { should eq '/' }
3434
its(:health_check_port) { should eq 'traffic-port' }
3535
its(:health_check_protocol) { should eq 'HTTP' }
36+
its(:health_check_code) { should eq '200-299' }
3637
it { should belong_to_alb('my-alb') }
3738
it { should belong_to_vpc('my-vpc') }
3839
end

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ variable "health_check_unhealthy_threshold" {
8080
default = 3
8181
}
8282

83+
variable "health_check_code" {
84+
description = "The HTTP codes that are a success when checking TG health"
85+
default = "200-299"
86+
}
87+
8388
variable "create_log_bucket" {
8489
description = "Create the S3 bucket (named with the log_bucket_name var) and attach a policy to allow ALB logging."
8590
default = false

0 commit comments

Comments
 (0)