gomplate-lambda-extension

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 11 Imported by: 0

README

gomplate-lambda-extension

a Gomplate extension for AWS Lambda

Getting Started

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

Installation

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

Configuration

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

License

Licensed under the MIT License
Copyright (c) 2022 Chris Ludden

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL