From bdeb59e46d9f34d8b8cb513ca66a322b3800b834 Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 2 Jan 2023 19:08:25 -0800 Subject: [PATCH] Health problems finally solved with LB and fargate --- infra/load-balancer.tf | 5 ++++- infra/route-table.tf | 7 +++++++ infra/security-groups.tf | 11 +++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/infra/load-balancer.tf b/infra/load-balancer.tf index f0b92b0..b8acc59 100644 --- a/infra/load-balancer.tf +++ b/infra/load-balancer.tf @@ -9,7 +9,10 @@ resource "aws_lb" "alpha" { internal = false load_balancer_type = "application" subnets = [ aws_subnet.delphi.id, aws_subnet.crete_subnet.id ] - security_groups = [ aws_security_group.ecs_web_ingress.id ] + security_groups = [ + aws_security_group.ecs_web_ingress.id, + aws_security_group.load_balancer_health_check.id + ] # TODO: change this to true later enable_deletion_protection = false } diff --git a/infra/route-table.tf b/infra/route-table.tf index 36f65ad..8901a67 100644 --- a/infra/route-table.tf +++ b/infra/route-table.tf @@ -10,7 +10,14 @@ resource "aws_route_table" "crete_route_table" { Name = "Crete IGW Route Table" } } + + resource "aws_route_table_association" "crete_gateway_association" { subnet_id = aws_subnet.crete_subnet.id route_table_id = aws_route_table.crete_route_table.id } + +resource "aws_route_table_association" "delphi_gateway_association" { + subnet_id = aws_subnet.delphi.id + route_table_id = aws_route_table.crete_route_table.id +} diff --git a/infra/security-groups.tf b/infra/security-groups.tf index 6f88905..41dd63c 100644 --- a/infra/security-groups.tf +++ b/infra/security-groups.tf @@ -40,6 +40,17 @@ resource "aws_security_group" "base_ecs" { } } +resource "aws_security_group" "load_balancer_health_check" { + name = "Load Balancer Health check" + vpc_id = aws_vpc.athens_vpc.id + egress { + cidr_blocks = ["10.0.0.0/8"] + from_port = 80 + to_port = 80 + protocol = "tcp" + } +} + resource "aws_security_group" "general_web_req" { name = "Athens General web server ruleset" description = "Allowing strictly web traffic"