Installation
How to install and set up sls.tf in your project
Prerequisites
Before you begin, make sure you have the following tools installed:
- Terraform (v1.0+) - For infrastructure deployment
- Node.js (v16+) - For development and testing
- Git - For version control
- AWS CLI - Configured with appropriate credentials
Usage
Reference sls.tf directly in your Terraform module source — no cloning or submodules needed.
Terraform downloads it automatically on terraform init.
lambda.tf (or main.tf)
module "my_service" {
source = "git::https://github.com/sls-tf/sls.tf.git?ref=v0.3.4"
config_path = "${path.module}/../serverless.yml"
config_format = "serverless"
aws_region = var.aws_region
}
Pin to a specific version tag (?ref=v0.3.4) so your infrastructure doesn't
change unexpectedly. Check the releases page
for the latest version.
For SAM templates (template.yaml), set config_format = "sam":
SAM template
module "my_service" {
source = "git::https://github.com/sls-tf/sls.tf.git?ref=v0.3.4"
config_path = "${path.module}/../template.yaml"
config_format = "sam"
aws_region = var.aws_region
} Initialise
Run terraform init to download the module — that's it:
terraform init
terraform plan
terraform apply Next Steps
Once you have sls.tf installed and working, check out these guides:
- Configuration Guide - Advanced configuration options
- Basic Example - Complete working example
- TypeScript Support - Using TypeScript configurations