-
Notifications
You must be signed in to change notification settings - Fork 0
/
alb.tf
33 lines (26 loc) · 844 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
resource "aws_alb_target_group" "main" {
name = "tf-${var.base_name}-ecs"
port = "${var.alb_container_port}"
protocol = "HTTP"
vpc_id = "${aws_vpc.main.id}"
health_check {
path = "${var.health_check_path}"
}
}
resource "aws_alb" "main" {
name = "tf-${var.base_name}-alb-ecs"
subnets = ["${aws_subnet.main.*.id}"]
security_groups = ["${aws_security_group.lb_sg.id}"]
depends_on = ["aws_internet_gateway.gw"]
}
resource "aws_alb_listener" "front_end" {
load_balancer_arn = "${aws_alb.main.id}"
port = "443"
protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-2015-05"
certificate_arn = "${aws_iam_server_certificate.elb_cert.arn}"
default_action {
target_group_arn = "${aws_alb_target_group.main.id}"
type = "forward"
}
}