TERRAFORM MODULE

serverless.yml
Terraform

Drop your serverless.yml. Get production Terraform. No rewrites.

v0.3.4 / MIT License / AWS
serverless.yml
service: my-api

provider:
  name: aws
  runtime: nodejs20.x
  stage: prod

functions:
  hello:
    handler: src/hello.handler
    events:
      - httpApi:
          path: /hello
          method: GET
main.tf
module "api" {
  source = "git::https://github.com/
    sls-tf/sls.tf.git?ref=v0.3.4"

  serverless_config = "./serverless.yml"
  environment       = "prod"
}

# Lambda, API GW, IAM roles —
# all provisioned automatically.
SAM Support

Reads both Serverless Framework serverless.yml and AWS SAM template.yaml — no migration step required.

Variable Resolution

Resolves ${self:custom.foo}, environment-specific overrides, and nested references at plan time.

TypeScript Configs

Evaluates TypeScript serverless.ts exports, including async factory functions that return the config object.

API Gateway

Provisions HTTP API v2 and REST API v1 resources, routes, integrations, and custom authorizers.

DynamoDB Tables

Creates tables declared in resources.Resources with keys, billing mode, TTL, and stream settings preserved.

IAM Roles

Synthesises least-privilege execution roles per function, merging provider-level and function-level statements.

Reference the module. Point at your config. Done.

main.tf
module "service" {
  source = "git::https://github.com/sls-tf/sls.tf.git?ref=v0.3.4"

  serverless_config = "./serverless.yml"  # or template.yaml
  environment       = "production"
  aws_region        = "us-east-1"
}
One command
terraform init
Fetches the module. No npm install. No CLI setup.
Pin a version
?ref=v0.3.4
Semver tags on every release. Upgrade on your schedule.

Start converting in 5 minutes

Read the docs →