Repolode
terraform-aws-modules

terraform-aws-modules/terraform-aws-lambda

Terraform module for creating AWS Lambda functions and layers, with built-in dependency installation and deployment package building.

Stars
1,042
Forks
783
Open issues
7
Last commit
9 days ago

What is it?

This Terraform module creates most AWS Lambda resources, including functions, layers, aliases, and event configurations. It also handles the build step, installing dependencies and packaging code into a deployment archive before Terraform deploys it.

Builds can run locally or inside Docker for any runtime and architecture that AWS Lambda supports. Packages can be stored locally or in S3, and deployments can use a prebuilt zip from local disk, S3, a URL, or an ECR image. Lambda@Edge, VPC, EFS, provisioned concurrency, IAM policies, and event source mappings are also configurable.

The module is part of the serverless.tf family and includes companion submodules for aliases and CodeDeploy-based rolling or canary deployments.

Key features

  • 01Builds dependencies locally or in Docker for any Lambda-supported runtime and architecture.
  • 02Creates deployment packages or deploys existing zips from local disk, S3, a URL, or ECR.
  • 03Stores deployment packages locally or in an S3 bucket.
  • 04Manages Lambda functions, layers, aliases, and Lambda@Edge.
  • 05Configures VPC, EFS, IAM policies, triggers, and event source mappings.

Use cases

  • Managing AWS Lambda functions and their IAM roles in Terraform alongside other infrastructure.
  • Packaging Python or Node.js Lambda code with pip or npm dependencies from a Terraform run.
  • Running canary or rolling deployments of Lambda functions through aliases and CodeDeploy.

Quick start

  1. 1

    Declare the module in your Terraform configuration with the source and required function arguments

  2. 2

    Initialize the Terraform working directory

    terraform init
  3. 3

    Preview and apply the planned infrastructure

    terraform apply

Things to know

  • Building dependencies requires Python 3.6 or newer.

Topics

FAQ

What is terraform-aws-lambda?
Terraform module for creating AWS Lambda functions and layers, with built-in dependency installation and deployment package building. This Terraform module creates most AWS Lambda resources, including functions, layers, aliases, and event configurations. It also handles the build step, installing dependencies and packaging code into a deployment archive before Terraform deploys it.
Is terraform-aws-lambda free to use? What license does it have?
terraform-aws-lambda is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is terraform-aws-lambda still maintained?
Actively maintained. The last commit to terraform-aws-lambda was on Oct 29, 2026.
What can I use terraform-aws-lambda for?
Managing AWS Lambda functions and their IAM roles in Terraform alongside other infrastructure. Packaging Python or Node.js Lambda code with pip or npm dependencies from a Terraform run. Running canary or rolling deployments of Lambda functions through aliases and CodeDeploy.
How do I install terraform-aws-lambda?
Declare the module in your Terraform configuration with the source and required function arguments Initialize the Terraform working directory: terraform init Preview and apply the planned infrastructure: terraform apply
Where can I get terraform-aws-lambda?
The source code and installation instructions are on GitHub: https://github.com/terraform-aws-modules/terraform-aws-lambda

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects