Comments (8)
Any updates on this?
We would definitely need something like this too. We are having exactly the same problem, where we do not want to include local node_modules
version, among other things.
We've thought about a workaround on creating a temporal directory where we place all needed files, and then zip that. But this glob paths support would highly simplify the process.
from terraform-provider-archive.
Just to add some context, glob paths would be perfect for ignoring things like node_modules. In my case, I am using this provider to create zip files for App Engine deployments and ideally don't want to include the local version of node_modules when deploying. Manually specifying each file to exclude isn't really feasible in this case 😞
from terraform-provider-archive.
This feature seems like its a no-brainer to add.
from terraform-provider-archive.
I don't mean to necro-bump this issue, but I landed here trying to solve similar problems. I ended up implementing a script which can be used via the external
data source which will archive a file and supports globbing patterns. I'm sure it's not perfect, but it's working for me and I thought it may help others who end up here from Google.
Example of usage:
data "external" "archive" {
program = ["python3", "${path.module}/external/archive.py"]
query = {
output_path = "./myarchive.zip"
source_path = "${path.module}/some/important/directory/"
# Exclusions match **file** names not directories
exclusions = jsonencode([
# These match relative to the source path
".git/**",
"env/**",
"node_modules/**",
# This could be anywhere underneath the source path
"**/__pycache__/**",
"**/*.pyc",
])
}
}
from terraform-provider-archive.
As a work around I've been using:
= setunion(
["package.json", "package-lock.json","README.md"],
fileset("${path.module}/../../../handlers/example", "node_modules/**")
)
It does makes smaller archives, but creating the archive takes way longer due to the exclude array becoming massive.
Having glob/doublestar built it would allow the best of both worlds; faster archiving and smaller archives
from terraform-provider-archive.
Ain't no way this is still open. 💀
from terraform-provider-archive.
This would be really useful. My current use case is packaging some python code for a lambda. Archiving the code is the only thing that is left out and only because I cannot exclude directories when creating the package from my repository root directory.
from terraform-provider-archive.
As a temp solution, I implemented a custom filtered_archive
module that gives this functionality.
Usage:
module "layer_archive" {
source = "[email protected]:asaf-kali/resources//tf/filtered_archive"
source_dir = "my_layer/"
name = "layer"
}
resource "aws_lambda_layer_version" "dependencies_layer" {
layer_name = "my-layer"
filename = module.layer_archive.output_path
source_code_hash = filebase64sha256(module.layer_archive.output_path)
depends_on = [
module.layer_archive,
]
}
It also supports exclude_patterns
variable (list of strings).
from terraform-provider-archive.
Related Issues (20)
- Migrate to terraform-plugin-framework HOT 1
- Run archive_file on each apply HOT 2
- data.archive_file does not support resource tainting HOT 2
- Bump Development/Build Minimum Go Version to 1.17 HOT 2
- Issue archiving base64 encoded content w/ source block HOT 5
- Bump Expected Minimum Go Version to 1.18 HOT 1
- archive_file doesn't re-create the archive upon content change
- Source_dir conflicts with source HOT 1
- Zip file created by terraform archive_file cannot be properly read by python
- Generated archive contents include an extra (empty) file when `output_path` is configured within same directory as `source_dir`. HOT 2
- Migrate acceptance testing to terraform-plugin-testing HOT 1
- Bump Expected Minimum Go Version to 1.19 HOT 1
- GitHub Actions - deprecated warnings found - action required! HOT 2
- archive_file data source gets created during "terraform plan" vs "terraform apply" and also is not deleted during destroy HOT 10
- Error generated during the execution of acceptance test on archive_file resource
- Documentation and changelog require updating HOT 1
- Support Additional Compression Types(Ex: tar.gz format) HOT 4
- Update Go Module to Go 1.20 Minimum HOT 1
- archive_file produces a corrupted zip file HOT 5
- Error generating archive with archive_file when symlink is present and exclude_symlink_directories is set to true HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-archive.