-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam.tf
41 lines (38 loc) · 1008 Bytes
/
iam.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
resource "aws_iam_role" "task_exec_role" {
count = var.custom_iam_task_exec_role_arn == "" ? 1 : 0
name = "${var.environment}-task-exec-role"
managed_policy_arns = [aws_iam_policy.task_exec_role[0].arn]
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = ["sts:AssumeRole"]
Effect = "Allow"
Sid = "1"
Principal = {
Service = "ecs-tasks.amazonaws.com"
}
}
]
})
}
resource "aws_iam_policy" "task_exec_role" {
count = var.custom_iam_task_exec_role_arn == "" ? 1 : 0
name = "${var.environment}-secret-manager-get-secret"
path = "/"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:DescribeLogStreams",
"logs:PutLogEvents"
]
Resource = ["arn:aws:logs:*"]
}
]
})
}