Skip to content

Commit

Permalink
fix: KMS least privileged access (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
djmctavish authored Jul 14, 2023
1 parent 013ef59 commit 4e004b7
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ data "aws_iam_policy_document" "cloudtrail_log_policy" {

principals {
type = "AWS"
identifiers = ["*"]
identifiers = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
}

condition {
Expand Down Expand Up @@ -356,7 +356,7 @@ data "aws_iam_policy_document" "kms_key_policy" {

principals {
type = "AWS"
identifiers = ["*"]
identifiers = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
}

actions = [
Expand All @@ -365,12 +365,6 @@ data "aws_iam_policy_document" "kms_key_policy" {
]
resources = ["*"]

condition {
test = "StringEquals"
variable = "kms:CallerAccount"
values = [data.aws_caller_identity.current.account_id]
}

condition {
test = "StringLike"
variable = "kms:EncryptionContext:aws:cloudtrail:arn"
Expand Down

0 comments on commit 4e004b7

Please sign in to comment.