From fb74569ce7f840647909b91accee90578a0374ed Mon Sep 17 00:00:00 2001 From: Benjamin Ryon Date: Sun, 7 Aug 2022 16:39:34 -0700 Subject: [PATCH 1/2] Update main.tf --- main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 2dc21bf..9c069f1 100644 --- a/main.tf +++ b/main.tf @@ -50,12 +50,13 @@ module "source_zip_file" { # (if build mode is CODEBUILD, LAMBDA, S3) # ############################################ -resource "aws_s3_bucket_object" "source_zip_file" { +resource "aws_s3_object" "source_zip_file" { count = var.enabled && contains(["CODEBUILD", "LAMBDA", "S3"], var.build_mode) ? 1 : 0 bucket = var.s3_bucket key = contains(["CODEBUILD", "LAMBDA"], var.build_mode) ? "${var.function_name}/${module.source_zip_file.output_sha}/source.zip" : var.s3_key source = module.source_zip_file.output_path + source_hash = module.source_zip_file.output_base64sha256 lifecycle { create_before_destroy = true From a2f9f0306ad40dc7a940db8a9f6dddf1fbdf0bae Mon Sep 17 00:00:00 2001 From: Benjamin Ryon Date: Sun, 7 Aug 2022 16:46:02 -0700 Subject: [PATCH 2/2] aws_s3_object --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 9c069f1..c1ad102 100644 --- a/main.tf +++ b/main.tf @@ -64,7 +64,7 @@ resource "aws_s3_object" "source_zip_file" { } locals { - source_zip_file_s3_key = var.enabled && contains(["CODEBUILD", "LAMBDA", "S3"], var.build_mode) ? aws_s3_bucket_object.source_zip_file[0].key : null + source_zip_file_s3_key = var.enabled && contains(["CODEBUILD", "LAMBDA", "S3"], var.build_mode) ? aws_s3_object.source_zip_file[0].key : null } ###############################################