Policy 1:
data "aws_iam_policy_document" "kms_policy" {
statement {
sid = "AllowEKSKMSAccess"
actions = [
"kms:*"
]
not_actions = [
"kms:Delete*",
"kms:ScheduleKeyDeletion",
"kms:Revoke*",
"kms:Disable*",
]
resources = ["*"]
}
}
Policy 2:
data "aws_iam_policy_document" "kms_policy" {
statement {
sid = "AllowEKSKMSAccess"
effect = "Allow"
actions = [
"kms:*"
]
resources = ["*"]
}
statement {
sid = "DenyEKSKMSDeletion"
effect = "Deny"
actions = [
"kms:Delete*",
"kms:ScheduleKeyDeletion",
"kms:Revoke*",
"kms:Disable*",
]
resources = ["*"]
}
}
I want to prevent 4 actions from within the role associated with a managed EKS node group.
Is policy 1 or policy 2 the preferred policy?
Is it better to have explicit deny
statements (along with allow
statements) in the same policy?