source_path

Required
Type string

Path to the function source code

Example

source_path = /path/to/resource

Path Formats

The source path can be:

  • A directory containing your source code
  • A pre-built zip file
  • A relative or absolute path

Directory Structure Examples

Python Function

src/
├── main.py       # Contains handler function
├── utils.py      # Helper modules
└── requirements.txt

Node.js Function

src/
├── index.js      # Contains handler function
├── lib/          # Helper modules
└── package.json

Best Practices

  • Use relative paths from your Terraform root
  • Keep function code in a dedicated directory
  • Include a requirements.txt or package.json for dependencies
  • Exclude test files and development dependencies

Full Module Example

module "lambda_function" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/lambda-function/aws"
  version = "0.1.0"

  # source_path
  source_path = /path/to/resource

  # Other required inputs
  function_name = my-resource
  runtime = python3.9
  handler = example-value
}