Skip to content

Commit eab9543

Browse files
include doc
1 parent fa64ba2 commit eab9543

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

iam-ecs-task.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,27 @@ resource "aws_iam_role_policy" "ssm_policy" {
6969
EOF
7070
}
7171

72+
# https://docs.aws.amazon.com/AmazonECR/latest/userguide/vpc-endpoints.html#ecr-setting-up-s3-gateway
73+
resource "aws_iam_role_policy" "s3_policy" {
74+
name = "ecs-s3-policy"
75+
role = aws_iam_role.ecs_task.name
76+
77+
policy = <<EOF
78+
{
79+
"Version": "2012-10-17",
80+
"Statement": [
81+
{
82+
"Action": [
83+
"s3:GetObject"
84+
],
85+
"Effect": "Allow",
86+
"Resource": ["arn:aws:s3:::prod-${data.aws_region.current.name}-starport-layer-bucket/*"]
87+
}
88+
]
89+
}
90+
EOF
91+
}
92+
7293
resource "aws_iam_role_policy_attachment" "extra_task_policies_arn" {
7394
for_each = toset(try(var.extra_task_policies_arn, []))
7495
role = aws_iam_role.ecs_task.name

0 commit comments

Comments
 (0)