-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs.tf
42 lines (34 loc) · 1.11 KB
/
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
36
37
38
39
40
41
42
locals {
cluster_name = local.resource_name
}
resource "aws_ecs_cluster" "this" {
name = local.cluster_name
tags = local.tags
// TODO: Enable execute command with encryption configured on logging
setting {
name = "containerInsights"
value = "enabled"
}
}
resource "aws_ecs_cluster_capacity_providers" "this" {
cluster_name = aws_ecs_cluster.this.name
capacity_providers = [aws_ecs_capacity_provider.this.name]
default_capacity_provider_strategy {
base = 1
weight = 100
capacity_provider = aws_ecs_capacity_provider.this.name
}
}
// https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-considerations
resource "aws_ecs_capacity_provider" "this" {
name = local.resource_name
auto_scaling_group_provider {
auto_scaling_group_arn = aws_autoscaling_group.this.arn
managed_termination_protection = "ENABLED"
managed_scaling {
status = "ENABLED"
target_capacity = var.target_capacity
instance_warmup_period = var.warmup_period
}
}
}