Giter Site home page Giter Site logo

Comments (8)

panoc1 avatar panoc1 commented on July 4, 2024 19

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.

tombailey avatar tombailey commented on July 4, 2024 14

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.

vyacheslav31 avatar vyacheslav31 commented on July 4, 2024 6

This feature seems like its a no-brainer to add.

from terraform-provider-archive.

calebstewart avatar calebstewart commented on July 4, 2024 4

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.

archive.py

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.

willfarrell avatar willfarrell commented on July 4, 2024 2

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.

vantaboard avatar vantaboard commented on July 4, 2024 1

Ain't no way this is still open. 💀

from terraform-provider-archive.

giannimassi avatar giannimassi commented on July 4, 2024

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.

asaf-kali avatar asaf-kali commented on July 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.