You have to specify lambda layers as ARNs in terraform using layers parameter:

layers - (Optional) List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function.

Using the following syntax in terraform:

layers = ["layer-arn"]

For example, the ARN for AWSLambda-Python27-SciPy1x in us-east-1 region is:

arn:aws:lambda:us-east-1:668099181075:layer:AWSLambda-Python27-SciPy1x:24

If you not sure what is your ARN, you can create a dummy a Python 2.7 lambda function, add AWS layer AWSLambda-Python27-SciPy1x layer, and the console will give you its ARN.

Answer from Marcin on Stack Overflow
🌐
Terraform
registry.terraform.io › modules › terraform-aws-modules › lambda › aws › latest › examples › complete
terraform-aws-modules/lambda/aws | complete Example | Terraform Registry
Configuration in this directory creates AWS Lambda Function, Layers, Alias, and so on with the large variety of supported features showing this module in action.
🌐
HashiCorp Discuss
discuss.hashicorp.com › terraform
How to import an external lambda layer into terraform? - Terraform - HashiCorp Discuss
November 14, 2019 - I’m trying to use datadog lambda layer in my lambda function to send datadog metrics: I can set this up manually from console. However, I’m not sure how to get it working in terraform. So far I have the following resource: resource "aws_lambda_layer_version" "datadog_layer" { layer_name = "${local.datadog_layer_name}" compatible_runtimes = ["python2.7"] } And I tried to import it with: terraform import ...
Find elsewhere
🌐
Medium
mahira-technology.medium.com › the-ultimate-guide-to-creating-lambda-layers-using-terraform-f64fa34b9b19
The Ultimate Guide to Creating Lambda Layers Using Terraform. | by Mahira Technology- Innovate. Transform. Thrive. | Medium
April 29, 2024 - The Ultimate Guide to Creating Lambda Layers Using Terraform. Overview :- Imagine you’ve written several Lambda functions, and they all use the same utility library or a particular SDK. Instead of …
🌐
LinkedIn
linkedin.com › pulse › how-deploy-aws-lambda-function-layer-using-terraform-hendrix-roa
How to deploy an AWS Lambda function with a layer using Terraform
June 10, 2023 - To create a layer, we just need to reference the module location (could be an external registry or local machine), in my the lambda layer location is one back folder at my root directory: module "lambda_noiselesstech" { source = "../terrafo...
🌐
HashiCorp Discuss
discuss.hashicorp.com › terraform
Terraform to create lambda layer by specify arn - Terraform - HashiCorp Discuss
January 7, 2021 - I’m trying to use libre office lambda layer in my lambda function : I can set this up manually from console. However, I’m not sure how to get it working in terraform. So far I have the following resource: data “archive_file” “converttopdf_lambda” { type = “zip” source_dir = “./data/converttopdf” output_path = “converttopdf.zip” } resource “aws_lambda_layer_version” “lambda_converttopdf_lambda” { layer_name = var.converttopdf_layername filename = “${data.archive_file....
🌐
My Devops Journal
skundunotes.com › 2024 › 09 › 29 › create-aws-lambda-layer-using-docker-terraform-and-github-actions
Create AWS Lambda Layer using Docker, Terraform and GitHub Actions – My Devops Journal
October 6, 2024 - The value would be a regular expression pattern: o-[a-z0-9]{10,32}. Terraform and GitHub Actions create the Lambda layer after the code is committed and pushed to a remote repository.
🌐
GitHub
github.com › enter-at › terraform-aws-lambda-layer
GitHub - enter-at/terraform-aws-lambda-layer: Terraform module designed to facilitate the creation of AWS Lambda layers
module "layer" { source = "git::https://github.com/enter-at/terraform-aws-lambda-layer.git?ref=main" layer_name = "dependencies" source_dir = "../src/lib" source_type = "python" rsync_pattern = [ "--exclude='**tests**'", "--exclude='**__pycache__**'", "--include=module/{a,b,c}/", "--include='*.py'", "--exclude='module/*'" ] } ... (Optional) The location of the package manager config file. Can be one of (package.json, requirements.txt, Pipfile) ... The Amazon Resource Name (ARN) of the Lambda layer with version.
Starred by 13 users
Forked by 14 users
Languages   HCL 56.0% | Shell 35.2% | Makefile 8.8% | HCL 56.0% | Shell 35.2% | Makefile 8.8%
🌐
Avangards
blog.avangards.io › 3-ways-to-publish-and-use-an-aws-lambda-layer-in-terraform
3 Ways To Publish and Use an AWS Lambda Layer in Terraform
April 2, 2025 - Learn about 3 different ways to build, publish, and use an AWS Lambda layer in Terraform to include additional dependencies for your Lambda functions.
🌐
Medium
aws.plainenglish.io › streamlining-serverless-applications-managing-aws-lambda-dependencies-with-layers-and-terraform-18968cf27811
Streamlining Serverless Applications: Managing AWS Lambda Dependencies with Layers and Terraform | by Yeldos Tanikin | AWS in Plain English
October 31, 2024 - This article will discuss the different ways to upload dependencies, introduce the concept of Lambda Layers, and demonstrate how to create a Lambda Layer using Terraform.
🌐
Shisho Cloud
shisho.dev › dojo › providers › aws › Lambda › aws-lambda-layer-version
AWS Lambda Layer Version - Examples and best practices | Shisho Dojo
Top / Amazon Web Service / AWS Lambda / Layer Version · This page shows how to write Terraform and CloudFormation for Lambda Layer Version and write them securely.