forked from sezginmutlu/terraform-project1-3-tier-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
elb.tf
45 lines (37 loc) · 1.2 KB
/
elb.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
# Create a new load balancer
resource "aws_elb" "wordpress" {
name = "wordpress1"
subnets = [
"${data.terraform_remote_state.dev.Subnet1}", ## ???
"${data.terraform_remote_state.dev.Subnet2}",
"${data.terraform_remote_state.dev.Subnet3}",
]
security_groups = [
"${data.terraform_remote_state.dev.sec_group_1}",
"${data.terraform_remote_state.dev.sec_group_2}"
]
listener {
instance_port = 80
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
target = "HTTP:80/"
interval = 30
}
cross_zone_load_balancing = true
idle_timeout = 400
connection_draining = true
connection_draining_timeout = 400
tags = {
Name = "foobar-terraform-elb"
}
}
resource "aws_autoscaling_attachment" "wordpress" {
autoscaling_group_name = "${module.dev.this_autoscaling_group_id}"
elb = "${aws_elb.wordpress.name}"
}