a Gomplate extension for AWS Lambda
The example directory provides a sample Terraform module that can be used to provision a Lambda function with this extension enabled.
Prereqs:
cd example
terraform init
terraform apply
Lambda layer For Lambda functions that use .zip deployments, include the following ARN as a layer in your Lambda function:
arn:aws:lambda:us-west-2:010013098410:layer:gomplate-lambda-extension:4
or publish your own layer:
just publish
Embed within Lambda container image
For Lambda functions that use container images, install the extension as part of the container build:
ADD https://github.com/cludden/gomplate-lambda-extension/releases/v0.1.0/download/gomplate-lambda-extension_0.1.0_linux_amd64 /opt/extensions/gomplate-lambda-extension
The extension is configured via Lambda environment variables.
Name | Description |
---|---|
GOMPLATE_DATASOURCE_{name} |
defines a named datasource |
GOMPLATE_INPUT |
anonymous input template (either inline or file path) |
GOMPLATE_INPUT_{name} |
configures a named template with an associated input file path |
GOMPLATE_OUTPUT |
output file path (e.g. /tmp/config.json ) |
GOMPLATE_OUTPUT_{name} |
configures a named template output file path |
The extension supports either a single anonymous template:
# inline
GOMPLATE_INPUT={"foo":"{{ (getenv "FOO" "bar") }}"}
GOMPLATE_OUTPUT=/tmp/config.json
# filesystem
GOMPLATE_INPUT=/tmp/config.tpl.json
GOMPLATE_OUTPUT=/tmp/config.json
or one or more named templates:
GOMPLATE_INPUT_config=/tmp/config.tpl.json
COMPLATE_OUTPUT_config=/tmp/config.json
COMPLATE_INPUT_data=/tmp/data.tpl.yml
COMPLATE_OUTPUT_data=/tmp/data.yml
Licensed under the MIT License
Copyright (c) 2022 Chris Ludden