Skip to content

Commit

Permalink
fix: 🐛 Upgrade to AL2023 provided runtime
Browse files Browse the repository at this point in the history
Fixes exec format / glibc error
  • Loading branch information
Clete2 committed Dec 7, 2023
1 parent ef3dbc4 commit bc63c95
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/build-release.sh
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
4 changes: 2 additions & 2 deletions tf-global-retention-setter.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tf-locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">5.26.0" # 5.26.0 supports Lambda runtime provided.al2023
}
}
}
Expand All @@ -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"]
}
4 changes: 2 additions & 2 deletions tf-log-retention-lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc63c95

Please sign in to comment.