Skip to content

Commit

Permalink
updated to support traditional ecs deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
kunduso committed Nov 27, 2024
1 parent ab62796 commit 135ca35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
21 changes: 4 additions & 17 deletions infra/load_balancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,8 @@ resource "aws_lb" "app_lb" {
}

#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group
resource "aws_lb_target_group" "blue_target_group" {
name = "${var.name}-blue"
port = 8080
protocol = "HTTP"
target_type = "ip"
vpc_id = aws_vpc.this.id
health_check {
matcher = "200,301,302,404"
path = "/healthcheck"
}
#checkov:skip=CKV_AWS_378: Ensure AWS Load Balancer doesn't use HTTP protocol
#This is disabled since this is non-prod.
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group
resource "aws_lb_target_group" "green_target_group" {
name = "${var.name}-green"
resource "aws_lb_target_group" "target_group" {
name = var.name
port = 8080
protocol = "HTTP"
target_type = "ip"
Expand All @@ -41,6 +27,7 @@ resource "aws_lb_target_group" "green_target_group" {
#checkov:skip=CKV_AWS_378: Ensure AWS Load Balancer doesn't use HTTP protocol
#This is disabled since this is non-prod.
}

Check warning

Code scanning / checkov

Ensure AWS Load Balancer doesn't use HTTP protocol Warning

Ensure AWS Load Balancer doesn't use HTTP protocol

Check warning

Code scanning / checkov

Ensure AWS Load Balancer doesn't use HTTP protocol Warning

Ensure AWS Load Balancer doesn't use HTTP protocol

#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener
resource "aws_alb_listener" "listener" {
#checkov:skip=CKV_AWS_2: This is disabled since this is non-prod.
Expand All @@ -50,7 +37,7 @@ resource "aws_alb_listener" "listener" {
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.blue_target_group.arn
target_group_arn = aws_lb_target_group.target_group.arn
}
lifecycle {
ignore_changes = [default_action]
Expand Down
6 changes: 2 additions & 4 deletions infra/ssm_parameter.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ resource "aws_ssm_parameter" "infra_output" {
value = jsonencode({
"subnet_ids" : [for subnet in aws_subnet.private : subnet.id],
"container_security_group_id" : "${aws_security_group.container_sg.id}",
"aws_lb_blue_target_group_arn" : "${aws_lb_target_group.blue_target_group.arn}",
"aws_lb_green_target_group_arn" : "${aws_lb_target_group.green_target_group.arn}",
"aws_lb_blue_target_group_name" : "${aws_lb_target_group.blue_target_group.name}",
"aws_lb_green_target_group_name" : "${aws_lb_target_group.green_target_group.name}",
"aws_lb_target_group_arn" : "${aws_lb_target_group.target_group.arn}",
"aws_lb_target_group_name" : "${aws_lb_target_group.target_group.name}",
"aws_lb_listener" : "${aws_alb_listener.listener.arn}",
"aws_lb" : "${aws_lb.app_lb.arn}",
"aws_vpc_id" : "${aws_vpc.this.id}",
Expand Down

0 comments on commit 135ca35

Please sign in to comment.