Adding generic health check for sample service

This commit is contained in:
shockrah 2022-12-16 22:49:55 -08:00
parent fafaae4ba7
commit 6b0f985cd9

View File

@ -14,15 +14,21 @@ resource "aws_lb" "alpha" {
enable_deletion_protection = false enable_deletion_protection = false
} }
# ECS services manage themselves when it comes to registering to the ## ECS services manage themselves when it comes to registering to the
# target group so we only need to provide the pool ## target group so we only need to provide the pool
#################################################################### #####################################################################
resource "aws_lb_target_group" "alpha_cluster" { resource "aws_lb_target_group" "alpha_cluster" {
name = "${var.athens_prefix}-alpha-cluster" name = "${var.athens_prefix}-alpha-cluster"
port = 80 port = 80
protocol = "HTTP" protocol = "HTTP"
target_type = "ip" target_type = "ip"
vpc_id = aws_vpc.athens_vpc.id vpc_id = aws_vpc.athens_vpc.id
health_check {
path = "/"
matcher = "200-299"
port = 80
interval = 60
}
} }
resource "aws_lb_listener" "http" { resource "aws_lb_listener" "http" {
@ -34,3 +40,4 @@ resource "aws_lb_listener" "http" {
target_group_arn = aws_lb_target_group.alpha_cluster.arn target_group_arn = aws_lb_target_group.alpha_cluster.arn
} }
} }