-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Add KMS policy to Velero IAM policy for CMK KMS keys #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: Add KMS policy to Velero IAM policy for CMK KMS keys #578
Conversation
Hi @bryantbiggs, any chance you could have a look at this one? |
@@ -1565,6 +1565,22 @@ data "aws_iam_policy_document" "velero" { | |||
] | |||
resources = var.velero_s3_bucket_arns | |||
} | |||
|
|||
dynamic "statement" { | |||
for_each = length(var.velero_s3_kms_key_arns) > 0 ? [1] : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work if you pass in computed values since those are unknown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've updated to code that this should be computed values safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, toset()
will not work either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, removed the toset
, the idea was there to "ignore" duplicates in the case there were any in the arns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this scenario, we can accept a list(string)
of KMS key ARNs, but we should have a 2nd variable like velero_enable_kms
that is a bool
type to toggle on/off since we can't rely on length()
or toset()
due to computed values not being known
Description
Adds and option to specify ARNs of KMS keys, for which additional policy blocks will be created containing actions to operate with these keys.
Motivation and Context
Using this module, if the
var.velero_s3_kms_key_arns
is set to an S3 bucket with default encryption set to customer managed KMS key (CMK), the backup will fail since the policy doesn't include statement with policies allowing operating this KMS keys (such askms:Encrypt
,kms:Decrypt
etc.).This is similar to the cases of EBS (
var.ebs_csi_kms_cmk_ids
) and S3 mountpoint (var.mountpoint_s3_csi_kms_arns
) controllers IAM policies created by this module that contain similar blocks for the same reason.Breaking Changes
No breaking changes, the newly introduced
var.velero_s3_kms_key_arns
variable has default of[]
which doesn't change the behaviour of the current configuration.How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull request