-
Notifications
You must be signed in to change notification settings - Fork 0
/
alb.tf
41 lines (37 loc) · 805 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
31
32
33
34
35
36
37
38
39
40
41
/**
* ALB
*/
resource "aws_alb" "aws-alb" {
name = "aws-alb"
internal = false
security_groups = ["${aws_security_group.aws_sg.id}"]
subnets = ["${aws_subnet.eu-west-1a-public.id}", "${aws_subnet.eu-west-1b-public.id}"]
enable_deletion_protection = false
}
/**
* Target group for ALB
*/
resource "aws_alb_target_group" "web" {
name = "$aws_tg_web"
port = 80
protocol = "HTTP"
vpc_id = "${aws_vpc.default.id}"
stickiness {
type = "lb_cookie"
}
health_check {
path = "/"
}
}
/**
* HTTP Lister for ALB
*/
resource "aws_alb_listener" "front_80" {
load_balancer_arn = "${aws_alb.aws-alb.arn}"
port = "80"
protocol = "HTTP"
default_action {
target_group_arn = "${aws_alb_target_group.web.arn}"
type = "forward"
}
}