-
Notifications
You must be signed in to change notification settings - Fork 0
/
roles.tf
40 lines (35 loc) · 847 Bytes
/
roles.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
# Basic policy to allow tasks to create and push logging event
resource "aws_iam_policy" "nginx_taskexec_policy" {
name = "nginx-taskexec"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"logs:CreateLogStream",
"logs:PutLogEvents"
]
Effect = "Allow"
Resource = "*"
},
]
})
}
# Attach the policy to a role that ecs can assume
resource "aws_iam_role" "nginx_taskexec_role" {
name = "nginx-taskexec"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Sid = ""
Principal = {
Service = "ecs-tasks.amazonaws.com"
}
},
]
})
managed_policy_arns = [aws_iam_policy.nginx_taskexec_policy.arn]
}