-
Notifications
You must be signed in to change notification settings - Fork 19
/
ecs.tf
35 lines (29 loc) · 1002 Bytes
/
ecs.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
resource "aws_ecs_cluster" "default" {
name = local.name
tags = local.tags
}
resource "aws_ecs_cluster_capacity_providers" "example" {
cluster_name = aws_ecs_cluster.default.name
capacity_providers = [aws_ecs_capacity_provider.asg.name]
dynamic "default_capacity_provider_strategy" {
for_each = var.enabled_default_capacity_provider ? [1] : []
content {
base = 1
weight = 100
capacity_provider = aws_ecs_capacity_provider.asg.name
}
}
}
resource "aws_ecs_capacity_provider" "asg" {
name = aws_autoscaling_group.ecs_nodes.name
auto_scaling_group_provider {
auto_scaling_group_arn = aws_autoscaling_group.ecs_nodes.arn
managed_termination_protection = local.protect_from_scale_in ? "ENABLED" : "DISABLED"
managed_scaling {
maximum_scaling_step_size = 10
minimum_scaling_step_size = 1
status = "ENABLED"
target_capacity = local.target_capacity
}
}
}