environment_variables
Environment variables passed to the function
Example
environment_variables = {}Environment Variable Limits
- Maximum size: 4 KB total for all environment variables
- Reserved prefixes:
AWS_,LAMBDA_are reserved by AWS
Common Use Cases
| Variable | Purpose |
|---|---|
LOG_LEVEL | Control logging verbosity |
STAGE | Environment identifier |
API_ENDPOINT | External API URLs |
TABLE_NAME | DynamoDB table name |
Best Practices
- Store secrets in AWS Secrets Manager or SSM Parameter Store
- Use environment variables for non-sensitive configuration
- Keep values short to stay within the 4 KB limit
- Document all environment variables used by your function
Full Module Example
module "lambda_function" {
source = "registry.patterneddesigns.ca/patterneddesigns/lambda-function/aws"
version = "0.1.0"
# environment_variables
environment_variables = {}
# Other required inputs
function_name = my-resource
runtime = python3.9
handler = example-value
source_path = /path/to/resource
}