Skip to content

alb-lambda-terraform: Update runtime to nodejs22.x #2803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kakakakakku
Copy link
Contributor

Issue #, if available:
N/A

Description of changes:
Hi😀 Thanks for the useful patterns!

To prevent future deployment issues, I updated the Lambda Node.js runtime version to nodejs22.x.

While testing alb-lambda-terraform, I noticed that the Lambda runtime version nodejs16.x was deprecated. Although it's still deployable at the moment, it will not be allowed after October 1, 2025.
https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

Check

terraform apply completed successfully and works good.

$ curl http://myLoadBalancer-1909689483.us-east-1.elb.amazonaws.com
"Hello World!"%

Thank you😀

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -3,7 +3,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~>4.52.0"
version = "~> 5.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Older version does not support Node.js 22 runtime. So I updated the version to v5.

@@ -172,12 +172,13 @@ resource "aws_lb_target_group" "target_group" {
resource "aws_lb_target_group_attachment" "target_group_attachment" {
target_group_arn = aws_lb_target_group.target_group.arn
target_id = aws_lambda_function.lambda_function.arn
depends_on = [aws_lambda_permission.with_lb]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I ran it twice, but I got an error both times.
So I added a dependency to wait for the aws_lambda_permission to be created.

first time

╷
│ Error: registering ELBv2 Target Group (arn:aws:elasticloadbalancing:us-east-1:000000000000:targetgroup/myLoadBalancerTargets/b89189d18213fa66) target: operation error Elastic Load Balancing v2: RegisterTargets, https response error StatusCode: 403, RequestID: f93d0159-c46d-4d61-a61f-ed598370fa3a, api error AccessDenied: elasticloadbalancing principal does not have permission to invoke arn:aws:lambda:us-east-1:000000000000:function:lambdaFunction from target group arn:aws:elasticloadbalancing:us-east-1:000000000000:targetgroup/myLoadBalancerTargets/b89189d18213fa66
│ 
│   with aws_lb_target_group_attachment.target_group_attachment,
│   on main.tf line 172, in resource "aws_lb_target_group_attachment" "target_group_attachment":
│  172: resource "aws_lb_target_group_attachment" "target_group_attachment" {
│ 
╵

second time

╷
│ Error: registering ELBv2 Target Group (arn:aws:elasticloadbalancing:us-east-1:000000000000:targetgroup/myLoadBalancerTargets/e9982eccdfc51ac0) target: operation error Elastic Load Balancing v2: RegisterTargets, https response error StatusCode: 403, RequestID: 03bb7f6d-cc4c-4806-bc8e-e6bd643707bf, api error AccessDenied: elasticloadbalancing principal does not have permission to invoke arn:aws:lambda:us-east-1:000000000000:function:lambdaFunction from target group arn:aws:elasticloadbalancing:us-east-1:000000000000:targetgroup/myLoadBalancerTargets/e9982eccdfc51ac0
│ 
│   with aws_lb_target_group_attachment.target_group_attachment,
│   on main.tf line 172, in resource "aws_lb_target_group_attachment" "target_group_attachment":
│  172: resource "aws_lb_target_group_attachment" "target_group_attachment" {
│ 
╵

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants