Skip to content

Commit 8cb7cb6

Browse files
authored
Added new kms policy for external write role (#388)
1 parent 544bf6a commit 8cb7cb6

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
@@ -504,3 +504,27 @@ resource "aws_iam_role_policy" "external_s3_read_move_policy" {
504504
role = aws_iam_role.write_access_role[count.index].id
505505
policy = data.aws_iam_policy_document.external_s3_read_move_policy_doc.json
506506
}
507+
508+
# KMS access policy for S3 audit bucket from external write role
509+
data "aws_iam_policy_document" "external_role_s3_audit_kms_access_policy" {
510+
statement {
511+
actions = [
512+
"kms:Encrypt",
513+
"kms:Decrypt",
514+
"kms:ReEncrypt*",
515+
"kms:GenerateDataKey*",
516+
"kms:DescribeKey"
517+
]
518+
resources = [
519+
module.s3_audit_bucket.storage_bucket_kms_key_arn
520+
]
521+
}
522+
}
523+
524+
# Attach KMS policy to external write role
525+
resource "aws_iam_role_policy" "external_audit_kms_access_policy" {
526+
count = length(aws_iam_role.write_access_role)
527+
name = "KMSAccessForS3Audit"
528+
role = aws_iam_role.write_access_role[count.index].id
529+
policy = data.aws_iam_policy_document.external_role_s3_audit_kms_access_policy.json
530+
}

0 commit comments

Comments
 (0)