You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
resource "aws_iam_role" "api_exec_role" { |
|
name = "${var.project}-exec-role" |
|
assume_role_policy = data.aws_iam_policy_document.api_exec_assume_role.json |
|
} |
|
|
|
data "aws_iam_policy_document" "api_exec_assume_role" { |
|
statement { |
|
actions = ["sts:AssumeRole"] |
|
principals { |
|
type = "Service" |
|
identifiers = ["ecs-task.amazonaws.com"] |
|
} |
|
} |
|
} |
|
|
|
resource "aws_iam_role_policy_attachment" "ecs_exec_iam_attach_assume_role" { |
|
role = aws_iam_role.api_exec_role.name |
|
policy_arn = data.aws_iam_policy_document.api_exec_assume_role |
|
} |
|
|
|
data "aws_iam_policy_document" "ecs_exec_role" { |
|
statement { |
|
effect = "Allow" |
|
actions = [ |
|
"ecr:GetAuthorizationToken", |
|
"ecr:BatchCheckLayerAvailability", |
|
"ecr:GetDownloadUrlForLayer", |
|
"ecr:BatchGetImage", |
|
"logs:CreateLogStream", |
|
"logs:PutLogEvents" |
|
] |
|
resources = ["*${var.project}*"] |
|
} |
|
} |
|
|
|
resource "aws_iam_role_policy_attachment" "ecs_exec_iam_attach_rules" { |
|
role = aws_iam_role.api_exec_role.name |
|
policy_arn = data.aws_iam_policy_document.ecs_exec_role.json |
|
}
|
|
|