Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions aws_modules/load_balancer/main.tf
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
resource "aws_lb" "alb" {
name = var.alb_name
internal = true
load_balancer_type = "application"
# security_groups = aws_security_group.security_group.id
subnets = ["value"]
enable_http2 = false
enable_deletion_protection = false

tags = {
name = "${var.alb_name}"
internal = true
load_balancer_type = "applcation"
security_groups = aws_security_group.security_group.id
subnets = [ "value" ]
enable_http2 = false
enable_deletion_protection = false

tags = {
name = "${var.alb_name}"
}
}
}


resource "aws_lb_target_group" "target_group" {
name = "${var.tg_name}"
port = 80
protocol = "HTTP"
target_type = "instance"
vpc_id = []

health_check {
path = "/"
protocol = "HTTP"
matcher = "200"
interval = 15
healthy_threshold = 3
timeout = 3
unhealthy_threshold = 3
}
name = var.alb_tg_name
port = 80
protocol = "HTTP"
target_type = "instance"
# vpc_id = []

health_check {
path = "/"
protocol = "HTTP"
matcher = "200"
interval = 15
healthy_threshold = 3
timeout = 3
unhealthy_threshold = 3
}

}

resource "aws_lb_target_group_attachment" "tg_atch" {
target_group_arn = aws_lb_target_group.target_group.arn
target_id = aws_lb_target_group.target_group.id
port = 80
target_group_arn = aws_lb_target_group.target_group.arn
target_id = aws_lb_target_group.target_group.id
port = 80
}

resource "aws_lb_listener" "front_end" {
load_balancer_arn = aws_lb.alb.arn
port = "80"
protocol = "HTTP"

default_action {
type = "forward"
target_group_arn = aws_lb_target_group.target_group.arn
}
load_balancer_arn = aws_lb.alb.arn
port = "80"
protocol = "HTTP"

default_action {
type = "forward"
target_group_arn = aws_lb_target_group.target_group.arn
}

}

2 changes: 1 addition & 1 deletion aws_modules/load_balancer/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "alb_id" {
value = aws_lb.lb.dns_name
value = aws_lb.alb
}
4 changes: 4 additions & 0 deletions aws_modules/load_balancer/variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ variable "alb_name" {
type = string
}

variable "alb_tg_name" {
description ="name of the application load balancer target group"
type = string
}