Input Variables

Complete reference for all configuration variables available in sls.tf

Required Variables

config_file

Type: string

Required: Yes

Description: Path to your serverless configuration file (serverless.yml or serverless.ts)

Example:

config_file = "${path.root}/serverless.yml"

region

Type: string

Required: Yes

Description: AWS region where resources will be deployed

Example:

region = "us-east-1"

environment

Type: string

Required: Yes

Description: Environment identifier for resource naming and configuration

Example:

environment = "production"

Optional Variables

tags

Type: map(string)

Required: No

Default:

Description: Tags to apply to all created resources

Example:

tags = {'{'}
  Project     = "My API"
  Owner       = "team@example.com"
  CostCenter  = "engineering"
  Environment = "production"
{'}'}

resource_prefix

Type: string

Required: No

Default: ""

Description: Prefix to add to all resource names

Example:

resource_prefix = "myapp"

stage_name

Type: string

Required: No

Default: "api"

Description: Stage name for API Gateway deployment

Example:

stage_name = "v1"

enable_cloudwatch_logs

Type: bool

Required: No

Default: true

Description: Enable CloudWatch logging for Lambda functions

Example:

enable_cloudwatch_logs = true

enable_xray_tracing

Type: bool

Required: No

Default: false

Description: Enable AWS X-Ray tracing for Lambda functions

Example:

enable_xray_tracing = true

enable_api_logs

Type: bool

Required: No

Default: true

Description: Enable API Gateway execution logging

Example:

enable_api_logs = true

Networking Variables

vpc_config

Type: object

Required: No

Description: VPC configuration for Lambda functions

Example:

vpc_config = {
  subnet_ids         = ["subnet-12345", "subnet-67890"]
  security_group_ids = ["sg-12345"]
}

Custom Domain Variables

custom_domain

Type: object

Required: No

Description: Custom domain configuration for API Gateway

Example:

custom_domain = {
  domain_name       = "api.example.com"
  certificate_arn   = "arn:aws:acm:us-east-1:123456789:certificate/12345"
  base_path         = "v1"
  create_route53_record = true
}

IAM Variables

iam_policies

Type: list(object)

Required: No

Description: Additional IAM policies to attach to Lambda execution role

Example:

iam_policies = [
  {
    name   = "dynamodb-access"
    policy = jsonencode({
      Version = "2012-10-17"
      Statement = [
        {
          Effect   = "Allow"
          Action   = ["dynamodb:GetItem", "dynamodb:PutItem"]
          Resource = "arn:aws:dynamodb:*:*:table/my-table"
        }
      ]
    })
  }
]

iam_role_arn

Type: string

Required: No

Description: Existing IAM role ARN to use instead of creating a new one

Example:

iam_role_arn = "arn:aws:iam::123456789:role/existing-lambda-role"

Environment Variables

environment_variables

Type: map(string)

Required: No

Description: Additional environment variables for all Lambda functions

Example:

environment_variables = {
  LOG_LEVEL      = "info"
  FEATURE_FLAGS  = "new_feature,experimental_api"
  CACHE_TTL      = "300"
}