-
Notifications
You must be signed in to change notification settings - Fork 2
/
load-balancers.tf
78 lines (66 loc) · 1.62 KB
/
load-balancers.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
resource "aws_elb" "cognoma-core" {
name = "cognoma-core-service"
subnets = [
"${aws_subnet.cognoma-1a.id}",
"${aws_subnet.cognoma-1b.id}"]
listener {
instance_port = 8000
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
health_check {
healthy_threshold = 10
unhealthy_threshold = 2
timeout = 5
target = "TCP:8000"
interval = 30
}
security_groups = ["${aws_security_group.cognoma-service.id}"]
instances = [
"${aws_instance.cognoma-service-1.id}",
"${aws_instance.cognoma-service-2.id}",
]
cross_zone_load_balancing = true
idle_timeout = 60
connection_draining = true
connection_draining_timeout = 400
internal = true
}
data "aws_acm_certificate" "cognoma-ssl-cert" {
domain = "api.cognoma.org"
statuses = ["ISSUED"]
}
resource "aws_elb" "cognoma-nginx" {
name = "cognoma-nginx"
subnets = [
"${aws_subnet.cognoma-1a.id}",
"${aws_subnet.cognoma-1b.id}"
]
listener {
instance_port = 80
instance_protocol = "http"
lb_port = 443
lb_protocol = "https"
ssl_certificate_id = "${data.aws_acm_certificate.cognoma-ssl-cert.arn}"
}
health_check {
healthy_threshold = 10
unhealthy_threshold = 2
timeout = 5
target = "TCP:80"
interval = 30
}
security_groups = [
"${aws_security_group.cognoma-service.id}",
"${aws_security_group.cognoma-public-elb.id}"
]
instances = [
"${aws_instance.cognoma-service-1.id}",
"${aws_instance.cognoma-service-2.id}"
]
cross_zone_load_balancing = true
idle_timeout = 60
connection_draining = true
connection_draining_timeout = 400
}