From 27796326e71495937c2263a0abbf0fa5182c7b8a Mon Sep 17 00:00:00 2001 From: Stretch Date: Wed, 18 Oct 2023 15:45:42 +0100 Subject: [PATCH] Add `source_hash` for the tfvars S3 objects (#29) * Ensures the file will be updated when changed --- s3-tfvars-files.tf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/s3-tfvars-files.tf b/s3-tfvars-files.tf index 2ee3ef3..5205777 100644 --- a/s3-tfvars-files.tf +++ b/s3-tfvars-files.tf @@ -1,8 +1,9 @@ resource "aws_s3_object" "tfvar_file" { for_each = local.tfvars_files - bucket = aws_s3_bucket.tfvars.id - key = each.value["key"] == "" ? each.value["path"] : each.value["key"] - source = each.value["path"] - kms_key_id = local.tfvars_kms_encryption ? aws_kms_key.tfvars[0].arn : null + bucket = aws_s3_bucket.tfvars.id + key = each.value["key"] == "" ? each.value["path"] : each.value["key"] + source = each.value["path"] + source_hash = filemd5(each.value["path"]) + kms_key_id = local.tfvars_kms_encryption ? aws_kms_key.tfvars[0].arn : null }