Skip to content

Commit

Permalink
add cw log key policy
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Nov 23, 2021
1 parent 6472786 commit 85309a6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cloudtrail-key/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,26 @@ data "aws_iam_policy_document" "key" {
values = [format("arn:%v:cloudtrail:*:%v:trail/*", local.partition, local.account_id)]
}
}
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html
statement {
sid = "Cloudwatch"
effect = "Allow"
actions = [
"kms:Encrypt*",
"kms:Decrypt*",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:Describe*"
]
resources = ["*"]
principals {
type = "Service"
identifiers = ["logs.amazonaws.com", "logs.${local.region}.amazonaws.com"]
}
condition {
test = "StringLike"
variable = "kms:EncryptionContext:aws:logs:arn"
values = [format("arn:%v:logs:%v:%v:log-group:*", local.partition, local.region, local.account_id)]
}
}
}

0 comments on commit 85309a6

Please sign in to comment.