-
Notifications
You must be signed in to change notification settings - Fork 51
/
capacity_provider.tf
26 lines (19 loc) · 1.03 KB
/
capacity_provider.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
resource "aws_ecs_capacity_provider" "autoscaling_group" {
count = var.include_asg_capacity_provider ? 1 : 0
name = "cp-${var.component}-${var.deployment_identifier}-${var.cluster_name}"
auto_scaling_group_provider {
auto_scaling_group_arn = aws_autoscaling_group.cluster.arn
managed_termination_protection = var.asg_capacity_provider_manage_termination_protection ? "ENABLED" : "DISABLED"
managed_scaling {
status = var.asg_capacity_provider_manage_scaling ? "ENABLED" : "DISABLED"
target_capacity = var.asg_capacity_provider_target_capacity
minimum_scaling_step_size = var.asg_capacity_provider_minimum_scaling_step_size
maximum_scaling_step_size = var.asg_capacity_provider_maximum_scaling_step_size
}
}
}
resource "aws_ecs_cluster_capacity_providers" "cluster_capacity_providers" {
count = var.include_asg_capacity_provider ? 1 : 0
cluster_name = aws_ecs_cluster.cluster.name
capacity_providers = var.include_asg_capacity_provider ? [aws_ecs_capacity_provider.autoscaling_group[0].name] : []
}