Skip to content

Commit

Permalink
fix: 🐛 Add conditional for dynamic KMS permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Clete2 committed Jun 19, 2023
1 parent 64dc3b0 commit 4c939e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tf-lambda-iam-role.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ data "aws_iam_policy_document" "log_retention" {
}
}

statement {
actions = ["kms:GenerateDataKey"]
resources = [var.kms_key_arn]
dynamic "statement" {
for_each = var.kms_key_arn == null ? [] : [var.kms_key_arn]
content {
actions = ["kms:GenerateDataKey"]
resources = [each.value]
}
}

statement {
Expand Down

0 comments on commit 4c939e5

Please sign in to comment.