I have a reusable module for lambdas that has a dummy zip file with one dummy text file in it. I provision the lambda, permissions, cron, env, whatever it needs. Then I use GitHub Actions to actually publish the real zip file. My IAC and app code live in different repos. Answer from derekmckinnon on reddit.com
🌐
Spacelift
spacelift.io › blog › terraform-aws-lambda
How to Manage AWS Lambda Functions with Terraform: Tutorial
3 weeks ago - In Terraform, an AWS Lambda function is defined using the aws_lambda_function resource. This resource specifies key details, including the function’s name, runtime environment (e.g., Python or Node.js), handler method, and source code location ...
🌐
AWS Fundamentals
awsfundamentals.com › blog › aws-lambda-with-terraform
Mastering AWS Lambda with Terraform
Quick TLDR: AWS Lambda is a service that handles serverless workloads, you write your business logic, deploy it and AWS handles the rest. You only pay when it runs. Terraform is a tool developed by Hashicorp to implement infrastructure as code.
🌐
GitHub
github.com › terraform-aws-modules › terraform-aws-lambda
GitHub - terraform-aws-modules/terraform-aws-lambda: Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations 🇺🇦
Using SAM CLI, you can invoke the lambda functions defined in the terraform application locally using the sam local invoke command, providing the function terraform address, or function name, and to set the hook-name to terraform to tell SAM CLI that the underlying project is a terraform application. You can execute the sam local invoke command from your terraform application root directory as following: sam local invoke --hook-name terraform module.hello_world_function.aws_lambda_function.this[0]
Starred by 1K users
Forked by 760 users
Languages   HCL 59.8% | Python 40.2%
🌐
Lumigo
lumigo.io › aws-lambda-deployment › aws-lambda-terraform
Deploying AWS Lambda with Terraform: Quick Tutorial and Basic Concepts · Dash0
3 weeks ago - Sign into the AWS Console, navigate to Amazon Identity and Access Management (IAM). Click Create IAM User and create a user with administrative privileges on both Amazon console and API. ... Now that everything is set up, we can start working in our default project directory. Create a directory for your project, for example {Terraform-folder}\lambda-test. Create a simple Hello World Lambda function with the following code, and name it hello.js.
🌐
DEV Community
dev.to › chinmay13 › configuring-an-aws-lambda-function-with-lambda-layers-and-function-url-using-terraform-25a0
Configuring an AWS Lambda Function with Lambda Layers and Function URL Using Terraform - DEV Community
February 10, 2025 - Now, create the Lambda function using Terraform. It will use the function code zip file, layer ARN and other parameters. ################################################################################ # Creating Lambda Function ################################################################################ resource "aws_lambda_function" "get_joke_lambda_function" { function_name = "ChuckNorrisJokes_Lambda" filename = "${path.module}/lambda_function.zip" runtime = "python3.12" handler = "chucknorris_jokes.lambda_handler" layers = [aws_lambda_layer_version.requests_layer.arn] memory_size = 128 timeout = 10 environment { variables = { API_URL = "https://api.chucknorris.io/jokes/random" } } source_code_hash = data.archive_file.lambda_function_archive.output_base64sha256 role = aws_iam_role.lambda_role.arn }
🌐
Terrateam
terrateam.io › blog › aws-lambda-function-with-terraform
Introduction to AWS Lambda with Terraform
February 16, 2023 - function description(pageContext) { const { post } = pageContext.data; return (post == null ? void 0 : post.description) || "Blog post from Terrateam"; }
Find elsewhere
🌐
HashiCorp Developer
developer.hashicorp.com › terraform › tutorials › aws services › serverless applications
Deploy serverless applications with AWS Lambda and API Gateway | Terraform | HashiCorp Developer
In this tutorial, you will deploy a NodeJS function to AWS Lambda, and then expose that function to the Internet using Amazon API Gateway. You can complete this tutorial using the same workflow with either Terraform Community Edition or HCP Terraform. HCP Terraform is a platform that you can ...
🌐
Medium
leejjon.medium.com › use-terraform-to-create-an-aws-lambda-function-that-runs-your-typescript-code-b805db667a93
Use Terraform to create an AWS Lambda function that runs your TypeScript code | by Leejjon | Medium
May 26, 2024 - The ugly part of AWS Lambda (and other AWS services such as Beanstalk) is that it’s not able to just grab an npm project and run npm start. That’s why in the above package.json I don’t specify a start script. It works with zip files like we live in the year 2000. We can create a deploy.sh file in our terraform folder to automate the creation of a zip file: function deploy { # Generate a version number based on a date timestamp so that it's unique TIMESTAMP=$(date +%Y%m%d%H%M%S) cd ../lambda/ && \ # Run the npm commands to transpile the TypeScript to JavaScript npm i && \ npm run build && \ npm prune --production &&\ # Create a dist folder and copy only the js files to dist.
🌐
Baeldung
baeldung.com › home › deployment tools › how to set up aws lambda function in terraform
How To Set Up AWS Lambda Function in Terraform | Baeldung on Ops
March 27, 2025 - This policy allows complete management of a specific Lambda function (hello_lambda), its associated CloudWatch Events rules, an IAM execution role (lambda_exec_role), and related CloudWatch Logs within the AWS account and region (us-east-1). ... $ aws iam create-policy \ --policy-name TerraformLambdaPolicy \ --policy-document file://terraform-policy.json { "Policy": { "PolicyName": "TerraformLambdaPolicy", "PolicyId": "ANPA4T4OCLX5U4EKMVY2C", "Arn": "arn:aws:iam::<ACCOUNT_ID>:policy/TerraformLambdaPolicy", "Path": "/", "DefaultVersionId": "v1", "AttachmentCount": 0, "PermissionsBoundaryUsageCount": 0, "IsAttachable": true, "CreateDate": "2025-02-14T15:51:06Z", "UpdateDate": "2025-02-14T15:51:06Z" } }
🌐
GitHub
github.com › cloudposse › terraform-aws-lambda-function
GitHub - cloudposse/terraform-aws-lambda-function: A module for launching Lambda Fuctions · GitHub
A module for launching Lambda Fuctions. Contribute to cloudposse/terraform-aws-lambda-function development by creating an account on GitHub.
Starred by 37 users
Forked by 45 users
Languages   HCL 77.6% | Go 16.7% | Makefile 5.7%
🌐
Kosli
kosli.com › blog › how-to-provision-your-aws-lambda-function-using-terraform
How to Provision Your AWS Lambda Function Using Terraform
In real-world use cases, you would usually have distinct names for each of your functions and their attributes. The next steps are the same. First, see the effect of your changes without applying them by running terraform plan. It should let you know that one new Lambda resource will be created: ... Terraform will perform the following actions: # aws_lambda_function.terraform_basic_lambda_func_2 will be created + resource "aws_lambda_function" "terraform_basic_lambda_func_2" { + architectures = (known after apply) + arn = (known after apply) + filename = "./code_2/hello-world.zip" + function_n
🌐
Medium
medium.com › @george.benjamin.lopez › building-testing-deploying-aws-lambda-with-terraform-1699e8d3cd9a
Mastering AWS Lambda Deployment with Terraform: Build, Test, and Deploy | by George Lopez | Medium
July 13, 2025 - In this article, we’ll walk through how to build, test, dockerize, and deploy an AWS Lambda function using tools like the AWS Lambda Runtime Interface Emulator (for local testing) and Terraform (for deployment).
🌐
Movestax
movestax.com › post › step-by-step-guide-to-aws-lambda-with-terraform
Step-by-Step Guide to AWS Lambda with Terraform
July 8, 2025 - Deploying a Lambda function with Terraform involves three key commands, each serving a specific purpose in the deployment process. ... Begin by running terraform init in your project directory. This command sets up your workspace by downloading the AWS provider and any necessary plugins:
🌐
GitHub
github.com › mineiros-io › terraform-aws-lambda-function
GitHub - mineiros-io/terraform-aws-lambda-function: A Terraform module for deploying and managing Lambda functions on Amazon Web Services (AWS). https://aws.amazon.com/lambda/
A Terraform module for deploying and managing Serverless Lambda Functions on Amazon Web Services (AWS).
Starred by 41 users
Forked by 24 users
Languages   HCL 74.8% | Go 13.9% | Makefile 11.3% | HCL 74.8% | Go 13.9% | Makefile 11.3%