Skip to content

Commit

Permalink
fix: Makes bucket kms key conditional (#29)
Browse files Browse the repository at this point in the history
* makes bucket kms key conditional

* update default value
  • Loading branch information
venky-wandb authored Jun 7, 2022
1 parent e0f731b commit 163625e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
43 changes: 23 additions & 20 deletions modules/app_eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,29 @@ resource "aws_iam_role" "node" {
}

# Encrypt and decrypt with KMS
inline_policy {
name = "${var.namespace}-node-kms-policy"
policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey"
],
"Resource" : [
"${var.bucket_kms_key_arn}"
]
}
]
})
dynamic "inline_policy" {
for_each = var.bucket_kms_key_arn == "" ? [] : [1]
content {
name = "${var.namespace}-node-kms-policy"
policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey"
],
"Resource" : [
"${var.bucket_kms_key_arn}"
]
}
]
})
}
}

# Publish cloudwatch metrics
Expand Down
2 changes: 1 addition & 1 deletion modules/app_eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ variable "bucket_sqs_queue_arn" {
}

variable "bucket_kms_key_arn" {
description = "(Required) The Amazon Resource Name of the KMS key with which S3 storage bucket objects will be encrypted."
description = "The Amazon Resource Name of the KMS key with which S3 storage bucket objects will be encrypted."
type = string
}

Expand Down

0 comments on commit 163625e

Please sign in to comment.