-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issue]: Terraform should only build+deploy Lambdas with changes #66
Comments
A related issue discussed in Slack: |
* Add TF module for building Lambda artifacts * Refactor terraform to build Lambdas with new module * Taskfile: add PersistFFISData to task:build helper * Add go and taskfile setup to "Validate and plan terraform" CI job
Builds currently generate inconsistent checksums in different VCS scenarios (git state is clean/dirty, different checked out commits, etc.). Reopening to address. |
Why is this issue important?
Building, uploading, and publishing all Lambda functions on every
terraform apply
makes iterating on Terraform changes slower than it needs to be. As a (much) secondary concern, it also uploads/publishes more Lambda artifacts than are necessary.Current State
When
terraform apply
runs, every Lambda function is re-deployed regardless of whether they have changed.The
terraform-aws-modules/lambda/aws
Terraform module that we use to facilitate Lambda deployments has facilities for comparing checksums of local builds against previous local builds (cached interraform/builds
), and should also be able to compare against remote (S3-hosted) artifacts. However, that doesn't seem to be having any effect in our current setup, which for the most part is customized by thesource_path
input to each Lambda module and looks like this:Additionally, our Taskfile configuration (which is used by Terraform in order to build Lambdas) also short-circuits builds when relevant source files are unmodified, which is worth being aware of when exploring solutions to this issue.
Expected State
Lambda functions only get deployed during
terraform apply
when the source code and/or local build artifacts are modified (at the very least in local (localstack) environments).Implementation Plan
Explore the documentation for the
terraform-aws-modules/lambda/aws
module and/or explore other alternatives to optimize this aspect of the build process.Relevant Code Snippets
No response
The text was updated successfully, but these errors were encountered: