-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs_task_update_loki.tf
45 lines (40 loc) · 1.28 KB
/
ecs_task_update_loki.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
/* IAM Permissions */
data "aws_iam_policy_document" "loki_update_assume_role_policy" {
statement {
effect = "Allow"
actions = [
"sts:AssumeRole"
]
principals {
identifiers = ["events.amazonaws.com"]
type = "Service"
}
}
}
resource "aws_iam_role" "loki_update_task_role" {
name = "loki-update-task-role"
assume_role_policy = data.aws_iam_policy_document.loki_update_assume_role_policy.json
}
/* container definition loki-updater */
data "template_file" "loki_update_container_definition" {
template = file("${path.module}/templates/loki_update_container_definition.tmpl")
vars = {
ssh_private_key = data.aws_secretsmanager_secret_version.ssh.arn
}
}
resource "aws_ecs_task_definition" "loki_update" {
container_definitions = data.template_file.loki_update_container_definition.rendered
family = "loki_update"
network_mode = "awsvpc"
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
task_role_arn = aws_iam_role.task_role.arn
requires_compatibilities = ["FARGATE"]
cpu = 256
memory = 512
volume {
name = "efs"
efs_volume_configuration {
file_system_id = data.aws_efs_file_system.efs.id
}
}
}