-
Notifications
You must be signed in to change notification settings - Fork 2
/
ecs.tf
61 lines (54 loc) · 1.35 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module "ecs" {
source = "terraform-aws-modules/ecs/aws"
version = "3.4.0"
name = "confluent-ansible-provisioner"
container_insights = true
capacity_providers = ["FARGATE", "FARGATE_SPOT"]
default_capacity_provider_strategy = [
{
capacity_provider = "FARGATE_SPOT"
}
]
tags = {
Environment = "Development"
}
}
data "aws_iam_role" "ecs" {
name = "AWSServiceRoleForECS"
}
resource "aws_ecs_task_definition" "service" {
family = "service"
container_definitions = jsonencode([
{
name = "cp-ansible"
image = "osodevops/cp-ansible:latest"
cpu = 10
memory = 512
essential = true
portMappings = [
{
containerPort = 80
hostPort = 80
}
]
}
])
volume {
name = "service-storage"
efs_volume_configuration {
file_system_id = aws_efs_file_system.cp-ansible.id
root_directory = "/opt/data"
transit_encryption = "ENABLED"
transit_encryption_port = 2999
authorization_config {
access_point_id = aws_efs_access_point.cp-ansible.id
iam = "ENABLED"
}
}
}
task_role_arn = data.aws_iam_role.ecs.arn
placement_constraints {
type = "memberOf"
expression = "attribute:ecs.availability-zone in [us-west-2a, us-west-2b]"
}
}