Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit b4dc706

Browse files
juladanpalm
andauthored
fix: set kms key on aws_s3_object when encryption is enabled (#2147)
* 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 <[email protected]> Co-authored-by: Niek Palm <[email protected]>
1 parent 448b2b0 commit b4dc706

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: modules/runner-binaries-syncer/runner-binaries-syncer.tf

+5-4
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ resource "aws_lambda_permission" "syncer" {
134134
###################################################################################
135135

136136
resource "aws_s3_object" "trigger" {
137-
bucket = aws_s3_bucket.action_dist.id
138-
key = "triggers/${aws_lambda_function.syncer.id}-trigger.json"
139-
source = "${path.module}/trigger.json"
140-
etag = filemd5("${path.module}/trigger.json")
137+
bucket = aws_s3_bucket.action_dist.id
138+
key = "triggers/${aws_lambda_function.syncer.id}-trigger.json"
139+
source = "${path.module}/trigger.json"
140+
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
141+
kms_key_id = try(var.server_side_encryption_configuration.rule.apply_server_side_encryption_by_default.kms_master_key_id, null)
141142

142143
depends_on = [aws_s3_bucket_notification.on_deploy]
143144
}

0 commit comments

Comments
 (0)