Skip to content

Commit 72d5db9

Browse files
authored
Merge branch 'main' into feature/hotfix-merge-to-main
2 parents 40c34ab + 8cb7cb6 commit 72d5db9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

infrastructure/stacks/api-layer/iam_policies.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,27 @@ resource "aws_iam_role_policy" "external_s3_read_move_policy" {
503503
role = aws_iam_role.write_access_role[count.index].id
504504
policy = data.aws_iam_policy_document.external_s3_read_move_policy_doc.json
505505
}
506+
507+
# KMS access policy for S3 audit bucket from external write role
508+
data "aws_iam_policy_document" "external_role_s3_audit_kms_access_policy" {
509+
statement {
510+
actions = [
511+
"kms:Encrypt",
512+
"kms:Decrypt",
513+
"kms:ReEncrypt*",
514+
"kms:GenerateDataKey*",
515+
"kms:DescribeKey"
516+
]
517+
resources = [
518+
module.s3_audit_bucket.storage_bucket_kms_key_arn
519+
]
520+
}
521+
}
522+
523+
# Attach KMS policy to external write role
524+
resource "aws_iam_role_policy" "external_audit_kms_access_policy" {
525+
count = length(aws_iam_role.write_access_role)
526+
name = "KMSAccessForS3Audit"
527+
role = aws_iam_role.write_access_role[count.index].id
528+
policy = data.aws_iam_policy_document.external_role_s3_audit_kms_access_policy.json
529+
}

0 commit comments

Comments
 (0)