terraform-aws-modules/terraform-aws-lambda

Add support for including raw file content in zip

fheinecke opened this issue · 4 comments

Is your request related to a new offering from AWS?

No

Is your request related to a problem? Please describe.

In some bootstrapping situations I need to build a Lambda source file via Terraform and have it included in the Lambda source.

Describe the solution you'd like.

I'd like to be able to specify raw file contents as a source under source_paths. Something like:

source_paths = [
{
  path = "path-in-zip.txt" # This path does not exist on the filesystem
  content = "This is a Terraform-built value that written to `path` inside the zip. It could come from a data source, a template, a literal, or some other Terraform logic."
}
]

This is similar to what the archive_file datasource can do.

Describe alternatives you've considered.

Create a local_file resource and include the path to it. As the documentation for this resource mentions, this is very very noisy in automation as it's recreated on every new machine that Terraform is ran on.

Additional context

This will be very useful especially because it's complex to remove the noise caused by local_sensitive_file/local_file. It will be nice to align with the functionality of archive_file.

Edge Lambda configuration restrictions limit the type of things that are possible for configuration purposes so using this module and trying to manage the configuration file and noise in a TF native way takes effort and less than ideal overheads.