Skip to content

Commit

Permalink
Replace etag with source_hash
Browse files Browse the repository at this point in the history
This avoids the etag behavior for multipart uploads from forcing an 
object update even when the source hasn't changed.
  • Loading branch information
reweeden committed Oct 3, 2024
1 parent 027b0c8 commit 1971902
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ resource "aws_s3_bucket" "lambda_source" {
}

resource "aws_s3_object" "lambda_source" {
bucket = aws_s3_bucket.lambda_source.bucket
key = "${filemd5(local.lambda_source_filename)}.zip"
source = local.lambda_source_filename
etag = filemd5(local.lambda_source_filename)
bucket = aws_s3_bucket.lambda_source.bucket
key = "${filemd5(local.lambda_source_filename)}.zip"
source = local.lambda_source_filename
source_hash = filemd5(local.lambda_source_filename)
}

resource "aws_s3_object" "lambda_code_dependency_archive" {
bucket = aws_s3_bucket.lambda_source.bucket
key = "${filemd5(local.dependency_layer_filename)}.zip"
source = local.dependency_layer_filename
etag = filemd5(local.dependency_layer_filename)
bucket = aws_s3_bucket.lambda_source.bucket
key = "${filemd5(local.dependency_layer_filename)}.zip"
source = local.dependency_layer_filename
source_hash = filemd5(local.dependency_layer_filename)
}

resource "aws_s3_object" "cloudformation_template" {
bucket = aws_s3_bucket.lambda_source.bucket
key = "${filemd5(local.cloudformation_template_filename)}.yaml"
source = local.cloudformation_template_filename
etag = filemd5(local.cloudformation_template_filename)
bucket = aws_s3_bucket.lambda_source.bucket
key = "${filemd5(local.cloudformation_template_filename)}.yaml"
source = local.cloudformation_template_filename
source_hash = filemd5(local.cloudformation_template_filename)
}

resource "aws_cloudformation_stack" "thin_egress_app" {
Expand Down

0 comments on commit 1971902

Please sign in to comment.