forked from appleboy/drone-terraform-in-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalb.tf
40 lines (34 loc) · 962 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
resource "aws_alb_target_group" "drone" {
name = "drone-ecs"
port = 8000
protocol = "HTTP"
vpc_id = "${aws_vpc.drone.id}"
target_type = "ip"
health_check {
path = "/healthz"
matcher = "200"
timeout = "5"
healthy_threshold = "3"
unhealthy_threshold = "2"
}
}
resource "aws_alb" "front" {
name = "drone-front-alb"
internal = false
security_groups = ["${aws_security_group.web.id}"]
subnets = ["${aws_subnet.drone_a.id}", "${aws_subnet.drone_c.id}"]
enable_deletion_protection = false
tags {
Name = "drone"
Environment = "${var.environment}"
}
}
resource "aws_alb_listener" "front_end_80" {
load_balancer_arn = "${aws_alb.front.id}"
port = "80"
protocol = "HTTP"
default_action {
target_group_arn = "${aws_alb_target_group.drone.id}"
type = "forward"
}
}