-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[feature request][archive_file] Allow source_file to be list of files #8565
Comments
I would like to augment @mtougeron idea with the following, which would make the archive resource even more powerful & flexible. We could benefit from 2 new attributes in order to handle more cases:
Use-case 1: Include files from multiple pathsLet's say you need to deploy a lambda to 2 different environments: dev and prod. This lambda aims to send data to a Google Service. You then need credentials that are different between the dev & prod. An idea to handle this would be to dynamically add the appropriate config file in the archive, following this: resource "archive_file" "init" {
type = "zip"
source_content_filename = "${path.module}/init.tpl"
output_path = "${path.module}/files/init.zip"
source_dir = "../mycode"
append_files = [
"../myconfig/config-${myenv}"
]
} Use-case 2: Exclude files from an archive (for instance to reduce the total size of the archive)Let's say you're doing some Python in your Lambda and you want to exclude some library files (boto3, pip binaries if using virtualenvs, etc.) The use-case would match this: resource "archive_file" "init" {
type = "zip"
source_content_filename = "${path.module}/init.tpl"
output_path = "${path.module}/files/init.zip"
source_dir = "../mycode"
exclude_files = [
"../mycode/bin",
"../mycode/lib/boto3",
"../mycode/env/lib/python2.7/site-packages/pip"
]
} What do you guys think? |
👍 Thank you |
@stumyp this is already the case as far as I understand what you meant :) |
Would be great to have list of files/dirs. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi, it would be nice if the
archive_file
resource allowedsource_file
andsource_dir
to be lists. It would also be nice if they were not mutually exclusive.For example, I'd like to use the following config to support my aws lambda functions.
The text was updated successfully, but these errors were encountered: