From 6b0f985cd95f10242ecc11b7c083e075d1141519 Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 16 Dec 2022 22:49:55 -0800 Subject: [PATCH] Adding generic health check for sample service --- infra/load-balancer.tf | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/infra/load-balancer.tf b/infra/load-balancer.tf index b5ea059..4a65d7e 100644 --- a/infra/load-balancer.tf +++ b/infra/load-balancer.tf @@ -14,15 +14,21 @@ resource "aws_lb" "alpha" { enable_deletion_protection = false } -# ECS services manage themselves when it comes to registering to the -# target group so we only need to provide the pool -#################################################################### +## ECS services manage themselves when it comes to registering to the +## target group so we only need to provide the pool +##################################################################### resource "aws_lb_target_group" "alpha_cluster" { name = "${var.athens_prefix}-alpha-cluster" port = 80 protocol = "HTTP" target_type = "ip" vpc_id = aws_vpc.athens_vpc.id + health_check { + path = "/" + matcher = "200-299" + port = 80 + interval = 60 + } } resource "aws_lb_listener" "http" { @@ -34,3 +40,4 @@ resource "aws_lb_listener" "http" { target_group_arn = aws_lb_target_group.alpha_cluster.arn } } +