Skip to content

Commit 05c1c11

Browse files
rlovenpalm
authored andcommitted
feat(syncer): account access control for distribution cache bucket (#585)
1 parent 76c3d9b commit 05c1c11

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

modules/runner-binaries-syncer/runner-binaries-syncer.tf

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,13 @@ resource "aws_s3_bucket_notification" "on_deploy" {
123123
depends_on = [aws_lambda_permission.on_deploy]
124124
}
125125

126+
data "aws_caller_identity" "current" {}
127+
126128
resource "aws_lambda_permission" "on_deploy" {
127-
statement_id = "AllowExecutionFromS3Bucket"
128-
action = "lambda:InvokeFunction"
129-
function_name = aws_lambda_function.syncer.arn
130-
principal = "s3.amazonaws.com"
131-
source_arn = aws_s3_bucket.action_dist.arn
129+
statement_id = "AllowExecutionFromS3Bucket"
130+
action = "lambda:InvokeFunction"
131+
function_name = aws_lambda_function.syncer.arn
132+
principal = "s3.amazonaws.com"
133+
source_account = data.aws_caller_identity.current.account_id
134+
source_arn = aws_s3_bucket.action_dist.arn
132135
}

0 commit comments

Comments
 (0)