From 7474e06f06714c89769facfe8cb342c9e3c39eaa Mon Sep 17 00:00:00 2001 From: MrDevopsman Date: Mon, 24 Feb 2025 13:18:09 +0000 Subject: [PATCH 1/4] Redundant ignore_changes element MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit │ Warning: Redundant ignore_changes element │ │ on .terraform/modules/security_header_lambda/aws_lambda_function.tf line 2, in resource "aws_lambda_function" "lambda": │ 2: resource "aws_lambda_function" "lambda" { │ │ Adding an attribute name to ignore_changes tells Terraform to ignore future changes to the argument in configuration after the │ object has been created, retaining the value originally configured. │ │ The attribute last_modified is decided by the provider alone and therefore there can be no configured value to compare with. │ Including this attribute in ignore_changes has no effect. Remove the attribute from ignore_changes to quiet this warning. ╵ --- aws_lambda_function.tf | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/aws_lambda_function.tf b/aws_lambda_function.tf index 23aca60..2fa802b 100644 --- a/aws_lambda_function.tf +++ b/aws_lambda_function.tf @@ -1,8 +1,8 @@ # Create the Lambda function. Each new apply will publish a new version. resource "aws_lambda_function" "lambda" { - function_name = var.function_name - description = var.description - provider = aws.cloudfront + function_name = var.function_name + description = var.description + provider = aws.cloudfront # Find the file from S3 s3_bucket = data.aws_s3_bucket.artifact_bucket.id s3_key = aws_s3_bucket_object.artifact.id @@ -15,13 +15,12 @@ resource "aws_lambda_function" "lambda" { lifecycle { ignore_changes = [ - last_modified, filename ] } tags = merge(var.common_tags, { "Name" = "${upper(var.environment)}-LOG-COLLECTOR-LAMBDA" - }, + }, ) } \ No newline at end of file From 6bfb5ca9ee2d280a8c3d48fa026a8d12c11d60f6 Mon Sep 17 00:00:00 2001 From: MrDevopsman Date: Mon, 24 Feb 2025 13:19:42 +0000 Subject: [PATCH 2/4] Deprecated Resource use aws_s3_object instead of aws_s3_bucket_object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ╷ │ Warning: Deprecated Resource │ │ with module.security_header_lambda.aws_s3_bucket_object.artifact, │ on .terraform/modules/security_header_lambda/aws_s3_bucket_object_artifact_upload.tf line 5, in resource "aws_s3_bucket_object" "artifact": │ 5: resource "aws_s3_bucket_object" "artifact" { │ │ use the aws_s3_object resource instead │ │ (and one more similar warning elsewhere) ╵ ╷ │ Warning: Argument is deprecated │ │ with module.security_header_lambda.aws_s3_bucket_object.artifact, │ on .terraform/modules/security_header_lambda/aws_s3_bucket_object_artifact_upload.tf line 7, in resource "aws_s3_bucket_object" "artifact": │ 7: bucket = data.aws_s3_bucket.artifact_bucket.id │ │ Use the aws_s3_object resource instead │ │ (and one more similar warning elsewhere) --- aws_s3_bucket_object_artifact_upload.tf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aws_s3_bucket_object_artifact_upload.tf b/aws_s3_bucket_object_artifact_upload.tf index 010954c..d965799 100644 --- a/aws_s3_bucket_object_artifact_upload.tf +++ b/aws_s3_bucket_object_artifact_upload.tf @@ -1,12 +1,12 @@ /** - * Upload the build artifact zip file to S3. + * Upload the build artifact zip file to S3 using aws_s3_object. * */ -resource "aws_s3_bucket_object" "artifact" { - provider = aws.cloudfront - bucket = data.aws_s3_bucket.artifact_bucket.id - key = "${var.function_name}.zip" - source = data.archive_file.zip_file_for_lambda.output_path - etag = filemd5(data.archive_file.zip_file_for_lambda.output_path) - tags = var.common_tags -} \ No newline at end of file +resource "aws_s3_object" "artifact" { + provider = aws.cloudfront + bucket = data.aws_s3_bucket.artifact_bucket.id + key = "${var.function_name}.zip" + source = data.archive_file.zip_file_for_lambda.output_path + etag = filemd5(data.archive_file.zip_file_for_lambda.output_path) + tags = var.common_tags +} From 70eeb2e561d57eaab820ded47b44d984be6d624b Mon Sep 17 00:00:00 2001 From: MrDevopsman Date: Mon, 24 Feb 2025 13:22:08 +0000 Subject: [PATCH 3/4] update resoruce on s3_key and s3_object_version to aws_s3_object. from aws_s3_bucket_object --- aws_lambda_function.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws_lambda_function.tf b/aws_lambda_function.tf index 2fa802b..1b8de7b 100644 --- a/aws_lambda_function.tf +++ b/aws_lambda_function.tf @@ -5,8 +5,8 @@ resource "aws_lambda_function" "lambda" { provider = aws.cloudfront # Find the file from S3 s3_bucket = data.aws_s3_bucket.artifact_bucket.id - s3_key = aws_s3_bucket_object.artifact.id - s3_object_version = aws_s3_bucket_object.artifact.version_id + s3_key = aws_s3_object.artifact.id + s3_object_version = aws_s3_object.artifact.version_id publish = true handler = var.lambda_handler From f71469298f0738f1b312ddd57ae81a971bd0ab51 Mon Sep 17 00:00:00 2001 From: osotopbot <72751587+osotopbot@users.noreply.github.com> Date: Mon, 24 Feb 2025 13:29:35 +0000 Subject: [PATCH 4/4] Auto Format --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a795abf..39169de 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ File a GitHub [issue](https://github.com/osodevops/aws-terraform-module-lambda-a ## The legals -Copyright © 2017-2024 [OSO](https://oso.sh) | See [LICENCE](LICENSE) for full details. +Copyright © 2017-2025 [OSO](https://oso.sh) | See [LICENCE](LICENSE) for full details. [OSO who we are](https://oso.sh/who-we-are/)