-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam_ecs_execution_role_httpbin.tf
41 lines (36 loc) · 1.07 KB
/
iam_ecs_execution_role_httpbin.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
data "aws_iam_policy_document" "assume_role_ecs_tasks" {
statement {
effect = "Allow"
principals {
type = "Service"
identifiers = ["ecs-tasks.amazonaws.com"]
}
actions = ["sts:AssumeRole"]
}
}
resource "aws_iam_role" "task_execution_httpbin" {
name = "httpbin-execution-role"
assume_role_policy = data.aws_iam_policy_document.assume_role_ecs_tasks.json
}
data "aws_iam_policy_document" "execution_role_httpbin" {
statement {
effect = "Allow"
actions = [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"logs:CreateLogStream",
"logs:PutLogEvents"
]
resources = ["*"]
}
}
resource "aws_iam_policy" "httpbin_execution_role" {
name = "httpbin-execution-role"
policy = data.aws_iam_policy_document.execution_role_httpbin.json
}
resource "aws_iam_role_policy_attachment" "httpbin_iam_execution" {
policy_arn = aws_iam_policy.httpbin_execution_role.arn
role = aws_iam_role.task_execution_httpbin.name
}