-
Notifications
You must be signed in to change notification settings - Fork 986
apigw-lambda-dynamodb-terraform: Update runtime to python3.12 #2799
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src.zip |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ terraform { | |
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 4.0.0" | ||
version = "~> 5.0" | ||
} | ||
random = { | ||
source = "hashicorp/random" | ||
|
@@ -56,9 +56,13 @@ resource "aws_s3_bucket" "lambda_bucket" { | |
force_destroy = true | ||
} | ||
|
||
resource "aws_s3_bucket_acl" "private_bucket" { | ||
resource "aws_s3_bucket_public_access_block" "private_bucket" { | ||
bucket = aws_s3_bucket.lambda_bucket.id | ||
acl = "private" | ||
|
||
block_public_acls = true | ||
block_public_policy = true | ||
ignore_public_acls = true | ||
restrict_public_buckets = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: The following error occurred when applying.
This issue is related to the changes described in the following blog post. To fix this, I enabled Block Public Access for the S3 bucket😀
|
||
} | ||
|
||
data "archive_file" "lambda_zip" { | ||
|
@@ -85,7 +89,7 @@ resource "aws_lambda_function" "apigw_lambda_ddb" { | |
s3_bucket = aws_s3_bucket.lambda_bucket.id | ||
s3_key = aws_s3_object.this.key | ||
|
||
runtime = "python3.8" | ||
runtime = "python3.12" | ||
handler = "app.lambda_handler" | ||
|
||
source_code_hash = data.archive_file.lambda_zip.output_base64sha256 | ||
|
@@ -222,4 +226,4 @@ resource "aws_lambda_permission" "api_gw" { | |
principal = "apigateway.amazonaws.com" | ||
|
||
source_arn = "${aws_apigatewayv2_api.http_lambda.execution_arn}/*/*" | ||
} | ||
} |
There was a problem hiding this comment.
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 Python 3.12 runtime. So I updated the version to v5.