Input Variables
Complete reference for all configuration variables available in sls.tf
Required Variables
config_path
Type: string
Required: Yes
Description: Path to your configuration file — a Serverless Framework serverless.yml, an AWS SAM template.yaml, or a TypeScript serverless.ts.
Example:
config_path = "${path.root}/template.yaml" Configuration Format
config_format
Type: string
Required: No
Default: "yaml"
Description: Format of the configuration file. One of "yaml" (serverless.yml), "sam" (AWS SAM template.yaml), or "typescript" (serverless.ts).
Example:
config_format = "sam" sam_template_parameters
Type: map(string)
Required: No
Default:
Description: Parameter values for AWS SAM templates. Keys are parameter names from the template's Parameters section; values override the parameter's Default.
Example:
sam_template_parameters = {
Stage = "prod"
TableName = "items-prod"
} strict_sam_intrinsics
Type: bool
Required: No
Default: false
Description: When true, CloudFormation intrinsics (!Ref, !Sub, !GetAtt) that cannot be resolved from supplied parameters or the template's own resources cause a plan-time error instead of placeholder strings. Leave false when using !GetAtt for co-planned resources whose ARNs are only known post-apply.
Example:
strict_sam_intrinsics = true Resources & Naming
aws_region
Type: string
Required: No
Default: null
Description: Optional AWS region override. If set and it differs from the region in your config, a warning is shown and this value is used.
Example:
aws_region = "us-east-1" resource_types
Type: list(string)
Required: No
Default: null (all supported types)
Description: Allowlist of CloudFormation resource types to materialise from the resources: section. Lambda functions, IAM roles, and all event wiring are always created; this only gates standalone infrastructure — useful when the SAM template is also used for sam local but the infra is managed elsewhere.
Example:
resource_types = ["AWS::Serverless::Function", "AWS::DynamoDB::Table"] stage_override
Type: string
Required: No
Default: null
Description: Overrides the stage used in every generated resource name (IAM roles, log groups, function names, event rules). Set a per-environment value (e.g. a PR-env slug) so multiple deployments of one template coexist in an account. null uses the template's provider.stage or "dev".
Example:
stage_override = "pr-1234" Lambda Packaging
lambda_code_path
Type: string
Required: No
Default: "."
Description: Path to the Lambda code directory to package into a zip at apply time. Ignored when lambda_code_source.type is "s3".
Example:
lambda_code_path = "${path.root}/src" lambda_code_source
Type: object({ type, bucket?, key_prefix?, sha? })
Required: No
Default: { type = "local" }
Description: Where each function's deployment package comes from. "local" builds a zip from lambda_code_path; "s3" treats the package as already present in a bucket (for git-ops models where CI builds once and promotes by bumping the SHA). bucket, key_prefix, and sha are required when type is "s3".
Example:
lambda_code_source = {
type = "s3"
bucket = "my-artifacts"
key_prefix = "services/items-api"
sha = "a1b2c3d"
} Variable Resolution
environment_vars
Type: map(string)
Required: No
Default:
Description: Values for ${env:} variable resolution in your config. Keys are variable names; values are what they resolve to.
Example:
environment_vars = {
LOG_LEVEL = "info"
CACHE_TTL = "300"
} strict_variable_resolution
Type: bool
Required: No
Default: true
Description: When true, fail on any unresolved variable. When false, unresolved variables are left as-is.
Example:
strict_variable_resolution = false max_variable_depth
Type: number
Required: No
Default: 10
Description: Maximum depth for recursive variable resolution, guarding against circular references. Must be between 1 and 50.
Example:
max_variable_depth = 20 Custom Domain
enable_custom_domain
Type: bool
Required: No
Default: false
Description: Enable custom domain configuration for API Gateway. Requires a provider.customDomain block in your config.
Example:
enable_custom_domain = true create_hosted_zone
Type: bool
Required: No
Default: false
Description: Create a Route 53 hosted zone if hostedZoneId is not provided in the customDomain configuration.
Example:
create_hosted_zone = true acm_certificate_arn
Type: string
Required: No
Default: null
Description: ACM certificate ARN for the custom domain. Fallback used when not specified in customDomain.certificateArn.
Example:
acm_certificate_arn = "arn:aws:acm:us-east-1:123456789012:certificate/abc-123" LocalStack Testing
use_localstack
Type: bool
Required: No
Default: false
Description: Enable LocalStack mode for testing. When true, all AWS provider endpoints point at LocalStack.
Example:
use_localstack = true localstack_endpoint
Type: string
Required: No
Default: "http://localhost:4566"
Description: LocalStack endpoint URL. Only used when use_localstack is true.
Example:
localstack_endpoint = "http://localhost:4566"