Skip to content

Commit c2cdd1b

Browse files
add support to empty kms key (#80)
1 parent 1aea634 commit c2cdd1b

File tree

1 file changed

+3
-3
lines changed
  • modules/integrations/cloud-logs

1 file changed

+3
-3
lines changed

modules/integrations/cloud-logs/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ locals {
7979
is_cross_account = var.bucket_account_id != null && var.bucket_account_id != data.aws_caller_identity.current.account_id
8080

8181
# KMS variables
82-
kms_account_id = split(":", var.kms_key_arn)[3]
83-
need_kms_policy = var.bucket_account_id != null && var.bucket_account_id != local.kms_account_id
82+
kms_account_id = var.kms_key_arn != null && var.kms_key_arn != "" ? split(":", var.kms_key_arn)[3] : null
83+
need_kms_policy = var.bucket_account_id != null && local.kms_account_id != null && var.bucket_account_id != local.kms_account_id
8484

8585
# Role variables
8686
role_name = var.role_name != null ? var.role_name : split("/", var.role_arn)[1]
@@ -171,7 +171,7 @@ data "aws_iam_policy_document" "cloudlogs_s3_access" {
171171
}
172172

173173
dynamic "statement" {
174-
for_each = var.kms_key_arn != null ? [1] : []
174+
for_each = var.kms_key_arn != null && var.kms_key_arn != "" ? [1] : []
175175
content {
176176
sid = "CloudlogsKMSDecrypt"
177177

0 commit comments

Comments
 (0)