hashicorp / terraform-provider-archive

Utility provider that provides a data source that can create zip archives for individual files or collections of files.
https://registry.terraform.io/providers/hashicorp/archive/latest/docs
Mozilla Public License 2.0
93 stars 63 forks source link

Feature request - add feature to add file to pre-existing archive in Archive provider #2

Open hashibot opened 7 years ago

hashibot commented 7 years ago

This issue was originally opened by @ponyfleisch as hashicorp/terraform#9904. It was migrated here as part of the provider split. The original body of the issue is below.


I'm using AWS Lambda with node, so i package all the dependencies in a zip file. I need to use the template rendering on the main file to set some configurable parameters. If i want to use the Archive provider to create a zip file with the main file and the node_modules directory, i need to keep the node_modules directory unzipped in my module repository.

It would be much better to keep the dependencies around as zip and then use the Archive provider to add the source file to it (creating a new output zip file in the process).

simonweil commented 2 years ago

Any chance to get this implemented?

ponyfleisch commented 2 years ago

@simonweil my implementation of it was never merged, but it’s here: https://github.com/hashicorp/terraform/pull/9924/commits

AbelHristodor commented 9 months ago

This could be really useful

air3ijai commented 4 months ago

Existing implementation will just override existing archive

# Add lambda to package
data "archive_file" "append" {
  type        = "zip"
  source_file = "lambda.py"
  output_path = "package.zip"
}

It would be very useful to be able to store lambda code separate from the archived package and just append it like we can do using zip

zip package.zip lambda.py

adding: lambda.py (deflated 37%)

Now we have just two options?

We can store package separate and use Lambda layers, but they are not supported in Lambda@Edge.