-
Notifications
You must be signed in to change notification settings - Fork 0
/
scale-group.tf
75 lines (69 loc) · 2.25 KB
/
scale-group.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
#############################################################################################################################
#
# EC2 AutoScalling Group
#
module "autoscaling_bastion" {
source = "git::https://github.com/jslopes8/terraform-aws-as-asgroup.git?ref=v2.0.7"
asg_name = "${local.stack_name}-AS"
min_size = 1
max_size = 1
vpc_zone_identifier = [
tolist(data.aws_subnet_ids.sn_priv.ids)[0],
tolist(data.aws_subnet_ids.sn_priv.ids)[1],
]
health_check_type = "ELB"
launch_configuration = module.launch_config_bastion.name
load_balancers = [ module.elb_bastion.id ]
# Scaling Policy
auto_scaling_policy_up = [
{
name = "${local.stack_name}-Policy-UP"
scaling_adjustment = "1"
adjustment_type = "ChangeInCapacity"
cooldown = "300"
policy_type = "SimpleScaling"
alarm_name = "${local.stack_name}-Metric-Alarm-UP"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
namespace = "AWS/EC2"
metric_name = "CPUUtilization"
period = "300"
statistic = "Average"
threshold = "60"
}
]
auto_scaling_policy_down = [
{
name = "${local.stack_name}-Policy-DOWN"
scaling_adjustment = "-1"
adjustment_type = "ChangeInCapacity"
cooldown = "300"
policy_type = "SimpleScaling"
alarm_name = "${local.stack_name}-Metric-Alarm-DOWN"
comparison_operator = "LessThanOrEqualToThreshold"
evaluation_periods = "2"
namespace = "AWS/EC2"
metric_name = "CPUUtilization"
period = "120"
statistic = "Average"
threshold = "5"
}
]
default_tags = [
{
"key" = "ApplicationRole"
"value" = "Bastion Host"
"propagate_at_launch" = true
},
{
"key" = "Environment"
"value" = "Production"
"propagate_at_launch" = true
},
{
"key" = "CostCenter"
"value" = "12345678"
"propagate_at_launch" = true
}
]
}