-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathalb.tf
30 lines (25 loc) · 749 Bytes
/
alb.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
resource "aws_lb" "this" {
name = "ALB-terra-app-auto-scaling"
security_groups = [aws_security_group.alb.id]
subnets = [aws_subnet.this["pub_a"].id, aws_subnet.this["pub_b"].id]
tags = merge(local.common_tags, { Name = "ALB-terra-app-auto-scaling" })
}
resource "aws_lb_target_group" "this" {
name = "ALB-TG-terra-app-auto-scaling"
port = 80
protocol = "HTTP"
vpc_id = aws_vpc.this.id
health_check {
path = "/"
healthy_threshold = 2
}
}
resource "aws_lb_listener" "this" {
load_balancer_arn = aws_lb.this.arn
port = 80
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.this.arn
}
}