Skip to content

Instantly share code, notes, and snippets.

@mailman-2097
Created August 10, 2020 04:32
Show Gist options
  • Select an option

  • Save mailman-2097/86b6d57af006049cf8f27b7e145fa1f5 to your computer and use it in GitHub Desktop.

Select an option

Save mailman-2097/86b6d57af006049cf8f27b7e145fa1f5 to your computer and use it in GitHub Desktop.
data "aws_iam_policy_document" "kms_policy" {
statement {
sid = "Enable Root user permissions"
effect = "Allow"
actions = ["kms:*"]
resources = ["*"]
principals {
type = "AWS"
identifiers = [
"arn:aws:iam::${local.account_id}:root",
]
}
}
statement {
sid = "Allow use of the key for cross account roles"
effect = "Allow"
actions = [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey",
"kms:CreateGrant",
"kms:ListGrants",
"kms:RevokeGrant",
]
resources = ["*"]
principals {
type = "AWS"
identifiers = ["*"]
}
condition {
test = "ForAnyValue:StringEquals"
variable = "aws:PrincipalOrgPaths"
values = [
local.target_principal_path,
local.security_ou_principal_path
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment