Skip to content

Commit

Permalink
fix: set kms key on aws_s3_object when encryption is enabled (#2147)
Browse files Browse the repository at this point in the history
* fix: set kms key on aws_s3_object when encryption is enabled

* Apply suggestions from code review

use try instead lookup to check if sse is enabled

Co-authored-by: Niek Palm <npalm@users.noreply.github.com>

Co-authored-by: Niek Palm <npalm@users.noreply.github.com>
  • Loading branch information
julada and npalm authored Jun 14, 2022
1 parent 448b2b0 commit b4dc706
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/runner-binaries-syncer/runner-binaries-syncer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ resource "aws_lambda_permission" "syncer" {
###################################################################################

resource "aws_s3_object" "trigger" {
bucket = aws_s3_bucket.action_dist.id
key = "triggers/${aws_lambda_function.syncer.id}-trigger.json"
source = "${path.module}/trigger.json"
etag = filemd5("${path.module}/trigger.json")
bucket = aws_s3_bucket.action_dist.id
key = "triggers/${aws_lambda_function.syncer.id}-trigger.json"
source = "${path.module}/trigger.json"
etag = try(var.server_side_encryption_configuration.rule.apply_server_side_encryption_by_default.kms_master_key_id, null) == null ? filemd5("${path.module}/trigger.json") : null
kms_key_id = try(var.server_side_encryption_configuration.rule.apply_server_side_encryption_by_default.kms_master_key_id, null)

depends_on = [aws_s3_bucket_notification.on_deploy]
}
Expand Down

0 comments on commit b4dc706

Please sign in to comment.