Example of Terraform configuration that showcase a two-steps (Go 1.1x
) AWS Lambda function deployment.
Blog post: https://a.l3x.in/blog/terrafom-lambda-no-archive-in-git/
The main reason is to avoid shipping the archive together with the configuration (that is, in Git). We only store the hash(es) of the last-built archive instead.
Might be useful when Terraform configuration is shared by multiple users.
-
clone this repository and
cd
into its working directory -
optional: edit
lambda/main.go
-
run
make build
to create the build archive -
setup your AWS environment (e.g.
export AWS_PROFILE=my-profile
) -
run
terraform init
-
run
terraform apply
: will prompt for- the bucket name to be created and used to host the build archive
- the AWS region where the resources will be created