Facing “expected runtime” Error for python3.12 in AWS Lambda with Terraform AWS Provider ~> 5.6.2

I’m encountering an error while trying to deploy an AWS Lambda function using Terraform. Although python3.12 is supported by AWS Lambda and works in other projects, I receive the following error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>expected runtime to be one of [nodejs nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x nodejs14.x nodejs16.x java8 java8.al2 java11 python2.7 python3.6 python3.7 python3.8 python3.9 dotnetcore1.0 dotnetcore2.0 dotnetcore2.1 dotnetcore3.1 dotnet6 nodejs4.3-edge go1.x ruby2.5 ruby2.7 provided provided.al2 nodejs18.x python3.10 java17 ruby3.2], got python3.12
</code>
<code>expected runtime to be one of [nodejs nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x nodejs14.x nodejs16.x java8 java8.al2 java11 python2.7 python3.6 python3.7 python3.8 python3.9 dotnetcore1.0 dotnetcore2.0 dotnetcore2.1 dotnetcore3.1 dotnet6 nodejs4.3-edge go1.x ruby2.5 ruby2.7 provided provided.al2 nodejs18.x python3.10 java17 ruby3.2], got python3.12 </code>
expected runtime to be one of [nodejs nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x nodejs14.x nodejs16.x java8 java8.al2 java11 python2.7 python3.6 python3.7 python3.8 python3.9 dotnetcore1.0 dotnetcore2.0 dotnetcore2.1 dotnetcore3.1 dotnet6 nodejs4.3-edge go1.x ruby2.5 ruby2.7 provided provided.al2 nodejs18.x python3.10 java17 ruby3.2], got python3.12

Environment:

  • Terraform Version: >=1.x
  • AWS Provider Version: ~> 5.6.2

Terraform Configuration:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.6.2"
}
}
required_version = ">= 1.8.3"
}
provider "aws" {
region = "us-west-2"
}
resource "aws_lambda_function" "put_data_to_dynamodb" {
filename = data.archive_file.lambda_package.output_path
function_name = "test-lambda"
role = aws_iam_role.lambda_execution_role.arn
handler = "index.lambda_handler"
source_code_hash = data.archive_file.lambda_package.output_base64sha256
runtime = "python3.12"
environment {
variables = {
DYNAMODB_TABLE_NAME = aws_dynamodb_table.security_aggregation_table.name
}
}
}
</code>
<code>terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 5.6.2" } } required_version = ">= 1.8.3" } provider "aws" { region = "us-west-2" } resource "aws_lambda_function" "put_data_to_dynamodb" { filename = data.archive_file.lambda_package.output_path function_name = "test-lambda" role = aws_iam_role.lambda_execution_role.arn handler = "index.lambda_handler" source_code_hash = data.archive_file.lambda_package.output_base64sha256 runtime = "python3.12" environment { variables = { DYNAMODB_TABLE_NAME = aws_dynamodb_table.security_aggregation_table.name } } } </code>
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.6.2"
    }
  }
required_version = ">= 1.8.3"
}

provider "aws" {
  region = "us-west-2"
}
resource "aws_lambda_function" "put_data_to_dynamodb" {
  filename         = data.archive_file.lambda_package.output_path
  function_name    = "test-lambda"
  role             = aws_iam_role.lambda_execution_role.arn
  handler          = "index.lambda_handler"
  source_code_hash = data.archive_file.lambda_package.output_base64sha256
  runtime          = "python3.12"
  
  environment {
    variables = {
      DYNAMODB_TABLE_NAME = aws_dynamodb_table.security_aggregation_table.name
    }
  }
}

Additional Information:

  • python3.12 works perfectly fine in other projects using a similar configuration.
  • I have verified that the AWS provider version is correctly specified as ~> 5.6.2.
  • I have ensured that the AWS region supports python3.12.

What I’ve Tried:

  1. Upgrading Terraform and AWS Provider: Ensured both are at the latest version.
  2. Verified AWS Lambda Runtime Availability: Confirmed python3.12 is supported in my AWS region.
  3. Running terraform init -upgrade: Ensured all providers are up-to-date.
  4. Using Other Runtimes: Successfully deployed with python3.9 and python3.10, but need to use python3.12.

Despite these steps, I still receive the same error. Any insights or suggestions on resolving this issue would be greatly appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật