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

Consider local_filepaths #217

Open
1 task done
olivers-xaxis opened this issue Jun 19, 2023 · 0 comments
Open
1 task done

Consider local_filepaths #217

olivers-xaxis opened this issue Jun 19, 2023 · 0 comments

Comments

@olivers-xaxis
Copy link

Terraform CLI and Provider Versions

Latest,

Use Cases or Problem Statement

Use case:

  • Your infra code needs to find folder names that do not end in a file name (they end in a folder name)
  • Your infra code needs to names of files or folders created during the apply (eg in a null resource, or by another provider that creates files)
  • Your infra code needs to locate other types of files that regular files or folders (eg symbolic links)

Problems:

  • fileset() does not show folders, only regular files
  • fileset() evaluates at the beginning of the terraform plan, so it cannot participate in the dependencies graph and occur later in the plan or even in the apply after some files have been created
  • fileset() does not find other types of files
  • local_file data source is for reading contents of a file as a string, rather than generating a list of strings

Proposal

Provide a local_filepaths data source with arguments:

  • path
  • pattern, default * meaning all matches that start with path, or null for exact match
  • type would default to file, but could also be folder (or directory if that's better), or * for all types (eventually could be symbolic links, etc)
  • pattern type (glob or regexp)

The result is a list of objects with attributes relpaths (list of paths relative to path), abspaths (list of absolute paths), and type (actual type resolved).

How much impact is this issue causing?

Medium

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant