Enable choosing between preserving or excluding parent directory when using source_dir
with archive_file
resource
#398
Labels
source_dir
with archive_file
resource
#398
Terraform CLI and Provider Versions
Terraform v1.10.4
on linux_amd64
Use Cases or Problem Statement
I'm currently using the
archive_file
resource to create a zip of a folder with multiple nested folders.Example structure of folder:
Terraform:
archive_file
includes the parent_folder, with all the files within it, i.e., when the archive is extracted, there is aparent_folder
at the root. However, for my usecase, the requirement is that theparent_folder
should not be included, i.e., file1 should be at the root when the file is unzipped.I tried
source_dir = "parent_folder/*"
, but that threw an error.I'm working around this by specifying each file in its own
source
block instead, but this become unscalable with complex directory structures.Proposal
Perhaps something like:
where if
skip_parent
istrue
, the archive includes only the files within the directory and not the directory itself.====
An alternative would be to preserve parent if there is no trailing forward-slash, and exclude parent if there is (as suggested in this related issue: #66 (comment)).
How much impact is this issue causing?
Medium
Additional Information
This seems to be the opposite problem to that mentioned in #66, so it seems like things worked differently in a previous version.
Code of Conduct
The text was updated successfully, but these errors were encountered: