Skip to content
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

Using exclude_symlink_directories also skips all directories lexically greater than the symlinked directory in the parent dir. #361

Open
1 task done
metmikel opened this issue Aug 20, 2024 · 1 comment
Labels

Comments

@metmikel
Copy link

metmikel commented Aug 20, 2024

Terraform CLI and Provider Versions

Terraform v1.9.4
on windows_amd64

  • Finding hashicorp/archive versions matching "2.5.0"...
  • Using previously-installed hashicorp/archive v2.5.0

Terraform Configuration

# Achive the files to include in the function app package
data "archive_file" "functionapp_archive" {
  type        = "zip"
  source_dir = "${path.module}/function"
  # This also skips all directories lexically greater than the symlinked directory in the parent directory
  exclude_symlink_directories = true
  output_path = "${path.module}/function-app.zip"
  # Excludes list drawn from .funcignore file
  excludes = [
    "**/*.js.map",
    "**/*.ts",
    ".git*",
    ".vscode",
    "__azurite_db*__.json",
    "__blobstorage__",
    "__queuestorage__",
    "local.settings.json",
    "test",
    "tsconfig.json"
  ]
}

Expected Behavior

I am zipping up the contents of a Typescript package to run as an Azure Function. To do this successfully I need to exclude the symlink to the package root directory that npm install creates under node_modules, but I need all the other directories and files present under node_modules to be included.

Actual Behavior

If I use exclude_symlink_directories = true to skip the symlink to the package root directory that npm install creates, then all remaining directories that are lexically greater than the symlink name in node_modules are skipped too.

Steps to Reproduce

  1. Create a default Typescript Azure Function under a directory called "function"
  2. Run npm install in the "function" directory to install the required node modules under node_modules.
  3. Create a Terraform script to zip up the "function" directory (using the Terraform snippet above)
  4. terraform init && terraform plan
  5. Examine the zip file created - note that under the node_modules directory, every directory lexically greater than the symlinked directory in the original directory has been skipped from the zip file.

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

A workaround is to include the symlink in the excludes block.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@metmikel metmikel added the bug label Aug 20, 2024
@metmikel
Copy link
Author

I believe I have fixed this in #362

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant