From bc63c95047c99fb5048e513d698cf1483d6c3f8c Mon Sep 17 00:00:00 2001 From: Clete Blackwell II Date: Thu, 7 Dec 2023 08:44:18 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Upgrade=20to=20AL2023=20p?= =?UTF-8?q?rovided=20runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes exec format / glibc error --- scripts/build-release.sh | 2 +- tf-global-retention-setter.tf | 4 ++-- tf-locals.tf | 4 ++++ tf-log-retention-lambda.tf | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/build-release.sh b/scripts/build-release.sh index a1a250d..440b2a9 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -1,6 +1,6 @@ #!/bin/bash -cargo lambda build --profile release-lambda --arm64 --disable-optimizations || exit 1 +cargo lambda build --profile release-lambda --arm64 || exit 1 mkdir -p dist/log_retention_setter cp target/lambda/terraform-aws-default-log-retention/bootstrap dist/log_retention_setter/ diff --git a/tf-global-retention-setter.tf b/tf-global-retention-setter.tf index f6227f7..71e7669 100644 --- a/tf-global-retention-setter.tf +++ b/tf-global-retention-setter.tf @@ -9,8 +9,8 @@ resource "aws_lambda_function" "global_log_retention" { function_name = local.global_log_retention_lambda_name filename = data.archive_file.global_log_retention.output_path source_code_hash = data.archive_file.global_log_retention.output_base64sha256 - runtime = "provided.al2" - architectures = ["arm64"] + runtime = local.runtime + architectures = local.architectures handler = "bootstrap" role = aws_iam_role.log_retention.arn timeout = 900 diff --git a/tf-locals.tf b/tf-locals.tf index d7cd7df..f5748bb 100644 --- a/tf-locals.tf +++ b/tf-locals.tf @@ -2,6 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" + version = ">5.26.0" # 5.26.0 supports Lambda runtime provided.al2023 } } } @@ -11,4 +12,7 @@ locals { global_log_retention_lambda_name = "${var.name}-global-log-retention-setter" iam_role_name = "${local.log_retention_lambda_name}${var.iam_role_suffix}" log_group_tags_json = var.log_group_tags == null ? "" : jsonencode(var.log_group_tags) # Null causes JSON parse error in Lambda + + runtime = "provided.al2023" + architectures = ["arm64"] } diff --git a/tf-log-retention-lambda.tf b/tf-log-retention-lambda.tf index 57dffb0..e5dc28a 100644 --- a/tf-log-retention-lambda.tf +++ b/tf-log-retention-lambda.tf @@ -9,8 +9,8 @@ resource "aws_lambda_function" "log_retention" { function_name = local.log_retention_lambda_name filename = data.archive_file.log_retention.output_path source_code_hash = data.archive_file.log_retention.output_base64sha256 - runtime = "provided.al2" - architectures = ["arm64"] + runtime = local.runtime + architectures = local.architectures handler = "bootstrap" role = aws_iam_role.log_retention.arn timeout = 60