Skip to content

Commit

Permalink
CCL-438 update kms policy to use single statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mynampatinaveen committed Sep 9, 2024
1 parent a8c10a2 commit dd31235
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/products/static-site/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ data "aws_iam_policy_document" "static_site_policy_document" {
]

resources = [
aws_kms_key.static_site_kms_test.arn,
aws_kms_key.static_site_kms.arn,
]
}
statement {
Expand Down
10 changes: 4 additions & 6 deletions modules/products/static-site/kms.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
resource "aws_kms_key" "static_site_kms_test" {
resource "aws_kms_key" "static_site_kms" {
enable_key_rotation = true
tags = local.common_tags
}

resource "aws_kms_key_policy" "static_site_kms_policy" {
key_id = aws_kms_key.static_site_kms_test.id
key_id = aws_kms_key.static_site_kms.id
policy = jsonencode({
Version = "2012-10-17"
Id = "static_site_kms_policy"
Expand All @@ -18,8 +18,6 @@ resource "aws_kms_key_policy" "static_site_kms_policy" {
}
Resource = ["*"]
},
]
Statement = [
{
Sid = "CloudFrontServiceKmsPolicy"
Action = [
Expand All @@ -39,7 +37,7 @@ resource "aws_kms_key_policy" "static_site_kms_policy" {
values = [aws_cloudfront_distribution.static_site_distribution.arn]
}
},
]
})
]
})
}

2 changes: 1 addition & 1 deletion modules/products/static-site/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "static_site_encry
bucket = aws_s3_bucket.static_site.id
rule {
apply_server_side_encryption_by_default {
kms_master_key_id = aws_kms_key.static_site_kms_test.arn
kms_master_key_id = aws_kms_key.static_site_kms.arn
sse_algorithm = "aws:kms"
}
bucket_key_enabled = true
Expand Down

0 comments on commit dd31235

Please sign in to comment.