-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathec2-asg.tf
More file actions
109 lines (93 loc) · 2.93 KB
/
ec2-asg.tf
File metadata and controls
109 lines (93 loc) · 2.93 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# ASG for the Consul Web Clients
resource "aws_autoscaling_group" "consul_client_web" {
name_prefix = "${var.main_project_tag}-web-asg-"
launch_template {
id = aws_launch_template.consul_client_web.id
version = aws_launch_template.consul_client_web.latest_version
}
target_group_arns = [aws_lb_target_group.alb_targets_web.arn]
desired_capacity = var.client_web_desired_count
min_size = var.client_web_min_count
max_size = var.client_web_max_count
# AKA the subnets to launch resources in
vpc_zone_identifier = aws_subnet.private.*.id
health_check_grace_period = 300
health_check_type = "EC2"
termination_policies = ["OldestLaunchTemplate"]
wait_for_capacity_timeout = 0
enabled_metrics = [
"GroupDesiredCapacity",
"GroupInServiceCapacity",
"GroupPendingCapacity",
"GroupMinSize",
"GroupMaxSize",
"GroupInServiceInstances",
"GroupPendingInstances",
"GroupStandbyInstances",
"GroupStandbyCapacity",
"GroupTerminatingCapacity",
"GroupTerminatingInstances",
"GroupTotalCapacity",
"GroupTotalInstances"
]
tags = [
{
key = "Name"
value = "${var.main_project_tag}-web"
propagate_at_launch = true
},
{
key = "Project"
value = var.main_project_tag
propagate_at_launch = true
}
]
# Allow time for internet access before installing external packages
depends_on = [aws_nat_gateway.nat]
}
# ASG for the Consul API Clients
resource "aws_autoscaling_group" "consul_client_api" {
name_prefix = "${var.main_project_tag}-api-asg-"
launch_template {
id = aws_launch_template.consul_client_api.id
version = aws_launch_template.consul_client_api.latest_version
}
desired_capacity = var.client_api_desired_count
min_size = var.client_api_min_count
max_size = var.client_api_max_count
# AKA the subnets to launch resources in
vpc_zone_identifier = aws_subnet.private.*.id
health_check_grace_period = 300
health_check_type = "EC2"
termination_policies = ["OldestLaunchTemplate"]
wait_for_capacity_timeout = 0
enabled_metrics = [
"GroupDesiredCapacity",
"GroupInServiceCapacity",
"GroupPendingCapacity",
"GroupMinSize",
"GroupMaxSize",
"GroupInServiceInstances",
"GroupPendingInstances",
"GroupStandbyInstances",
"GroupStandbyCapacity",
"GroupTerminatingCapacity",
"GroupTerminatingInstances",
"GroupTotalCapacity",
"GroupTotalInstances"
]
tags = [
{
key = "Name"
value = "${var.main_project_tag}-api"
propagate_at_launch = true
},
{
key = "Project"
value = var.main_project_tag
propagate_at_launch = true
}
]
# Allow time for internet access before installing external packages
depends_on = [aws_nat_gateway.nat]
}