Skip to content

Commit

Permalink
update kms policy
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jan 2, 2024
1 parent bee5f23 commit de936d4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions s3-config-org/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module "config_org" {

# Links
* https://cloudyadvice.com/2022/04/14/automated-enterprise-deployment-of-aws-config/
* https://docs.aws.amazon.com/config/latest/developerguide/s3-kms-key-policy.html

## Requirements

Expand Down
31 changes: 30 additions & 1 deletion s3-config-org/kms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,36 @@ data "aws_iam_policy_document" "key_admin" {

data "aws_iam_policy_document" "empty" {}

data "aws_iam_policy_document" "key" {}
data "aws_iam_policy_document" "key" {
statement {
sid = "IAMPermissionsAccessKMSManagement"
effect = "Allow"
actions = ["kms:*"]
resources = ["*"]
principals {
type = "AWS"
identifiers = [local.kms_admin_root]
}
}
statement {
sid = "AWSConfigKMSPolicy"
effect = "Allow"
actions = [
"kms:Decrypt",
"kms:GenerateDataKey",
]
principals {
type = "Service"
identifiers = ["config.amazonaws.com"]
}
resources = ["*"]
condition {
test = "StringEquals"
variable = "aws:PrincipalOrgId"
values = [local.organization_id]
}
}
}

## data "aws_iam_policy_document" "key" {
## policy_id = "object-logging-cloud-trail"
Expand Down
1 change: 1 addition & 0 deletions s3-config-org/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*
* # Links
* * https://cloudyadvice.com/2022/04/14/automated-enterprise-deployment-of-aws-config/
* * https://docs.aws.amazon.com/config/latest/developerguide/s3-kms-key-policy.html
*/

locals {
Expand Down

0 comments on commit de936d4

Please sign in to comment.