One infrastructure language.
Describe serverless and supporting resources in Terraform.
Bring your application code and AWS infrastructure into one Terraform-based workflow. Build with reusable modules. Start with examples you can make your own.
API GatewayReceive
LambdaCompute
DynamoDBStoreThe approach
APIs, permissions, events, and data belong to the same system. Manage them with a consistent approach.
Describe serverless and supporting resources in Terraform.
Compose modules and inspect their source instead of starting from scratch.
Use source packaging or existing artifacts, and keep the testing and CI steps your project needs.
Here, the API route uses the Lambda module’s function ARN. That reference tells Terraform how the resources depend on each other.
Review the plan, then apply changes through your deployment workflow. Keep application tests in your own pipeline.
Read the workflow guidemodule "api_gateway" {
source = "terraform-aws-modules/apigateway-v2/aws"
version = "~> 6.1"
name = "serverless-http"
protocol_type = "HTTP"
create_domain_name = false
routes = {
"ANY /" = {
integration = {
uri = module.lambda_function.lambda_function_arn
payload_format_version = "2.0"
}
}
}
}
module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
version = "~> 8.12"
function_name = "serverless-http"
handler = "index.lambda_handler"
runtime = "python3.12"
source_path = "${path.module}/src"
publish = true
allowed_triggers = {
api_gateway = {
service = "apigateway"
source_arn = "${module.api_gateway.api_execution_arn}/*/*"
}
}
}
Put your Python handler in src/index.py as lambda_handler. Configure the AWS provider with your region and credentials, then use these two module calls together. The route invokes the function; allowed_triggers grants API Gateway permission.
Inspect the full configurationChoose the part you want to inspect. Each link opens a separate upstream example.
Compare building from source with using an existing archive.
Inspect source_path and local_existing_package.
Follow the API route’s connection to a Lambda function.
Inspect routes and allowed_triggers.
Follow a published function version through an alias into CodeDeploy.
Inspect alias_refresh and target_version.
Supported services
Built on terraform-aws-modules, heavily used by AWS customers, with over 2 billion provisions. Explore the modules and examples behind the serverless.tf ecosystem.
18 services
2 services
7 services
4 services
5 services
A few useful answers
Scope, workflow, and where to go next.
A Terraform-based approach to AWS serverless applications, built around open-source modules and workflow guidance.
compliance.tf provides variants of supported Terraform AWS modules with module-level controls, organization rules, and framework mappings. Review coverage for your module and requirements before adopting it. Explore compliance.tf.
No. This project has nothing to do with Serverless Framework. serverless.tf uses Terraform and open-source AWS modules.
Keep the workflow that fits your project. Read the Lambda module’s packaging options and deployment guidance to see where it fits.
Check AWS Lambda’s supported runtimes and the module’s build requirements for your code and packaging method.
This website and its module catalog focus on AWS.
Visit Betajob to discuss your Terraform and serverless project.
Make it your own
Find an example, read the code, and build from there.