Skip to content

Commit 748efa8

Browse files
authored
Merge pull request #16 from DNXLabs/feature/cross_account_policy
Adding AWS Lambda cross account deploy policy
2 parents b3553ad + b8d4e6f commit 748efa8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ecr-policies.tf

+20
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@ resource "aws_ecr_repository_policy" "default" {
3737
"ecr:UploadLayerPart",
3838
"ecr:CompleteLayerUpload"
3939
]
40+
},
41+
{
42+
"Sid": "LambdaECRImageCrossAccountRetrievalPolicy",
43+
"Effect": "Allow",
44+
"Principal": {
45+
"Service": [
46+
"lambda.amazonaws.com"
47+
]
48+
},
49+
"Action": [
50+
"ecr:GetDownloadUrlForLayer",
51+
"ecr:BatchGetImage"
52+
],
53+
"Condition": {
54+
"StringLike": {
55+
"aws:sourceArn": [
56+
${join(",", formatlist("\"arn:aws:lambda:%s:%s:function:*\"", data.aws_region.current.name, var.trust_accounts))}
57+
]
58+
}
59+
}
4060
}
4161
]
4262
}

0 commit comments

Comments
 (0)