Skip to content

Commit 60d56ad

Browse files
authored
Add AmazonEC2ContainerRegistryReadOnly policy to provide read-only access to ECR repositories (#15)
1 parent 760479e commit 60d56ad

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ resource "aws_iam_role_policy_attachment" "ssm-automation" {
122122
}
123123
}
124124

125+
# http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html
126+
# http://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html#AmazonEC2ContainerRegistryReadOnly
127+
resource "aws_iam_role_policy_attachment" "ecr-readonly" {
128+
role = "${aws_iam_role.ec2.name}"
129+
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
130+
}
131+
125132
resource "aws_ssm_activation" "ec2" {
126133
name = "${module.label.id}"
127134
iam_role = "${aws_iam_role.ec2.id}"

0 commit comments

Comments
 (0)