source_path
RequiredPath to the function source code
Example
source_path = /path/to/resourcePath 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.txtorpackage.jsonfor 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
}