-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload-balancer.tf
45 lines (37 loc) · 1.13 KB
/
load-balancer.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
42
43
44
45
# Create a new application load balancer.
resource "aws_alb" "terraform_alb" {
name = "terraform-alb"
subnets = [
"${aws_subnet.terraform_cluster_subnet_1.id}",
"${aws_subnet.terraform_cluster_subnet_2.id}",
]
security_groups = ["${aws_security_group.terraform_sg_alb.id}"]
tags {
Name = "Generated by Terraform - Terraform alb"
}
}
# Create a new target group for the application load balancer.
resource "aws_alb_target_group" "terraform_alb_group" {
name = "terraform-test-alb-target"
port = 80
protocol = "HTTP"
vpc_id = "${aws_vpc.terraform_vpc.id}"
stickiness {
type = "lb_cookie"
}
# Alter the destination of the health check to be the specific file page.
# health_check {
# path = "/healthcheck.html"
# port = 80
# }
}
# Create a new application load balancer listener for HTTP.
resource "aws_alb_listener" "terraform_alb_listener_http" {
load_balancer_arn = "${aws_alb.terraform_alb.arn}"
port = "80"
protocol = "HTTP"
default_action {
target_group_arn = "${aws_alb_target_group.terraform_alb_group.arn}"
type = "forward"
}
}