You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to zip a folder and add a single extra file to the archive which is a config file created using the templatefile function. If I can add the content directly to the zip then I don't need to use the local_file resource, which creates churn at plan time.
I was wondering what the conflict was as I couldn't think what the conflict could be (duplicate filenames seem possible with source too).
Proposal
Adjust validation so source_dir and source can be specified at the same time.
I could imagine it's desirable to create a "source_file" block attribute that contains file include/excludes, and they could be mixed with the current source blocks. That sounds like a lot more work though.
How much impact is this issue causing?
Low
Additional Information
Big benefit of this would be removal of plan churn because the only current way to make this work is to use local_file provider
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
One workaround for this is to use a combination of a dynamic block and the fileset function. This method works without using the local_file resource.
For instance, the following code creates an archive that contains both the content of the local.source_path folder, as well as the contents of local.config in the config file.
Performance should be similar to using source_dir. Looking at zip_archiver.go both methods fully read every file into memory first. Note that using source_dir stores the file mode and modification date in the archive, while source does not.
In any case, I agree being able to use both source_dir and source together would be nice!
Terraform CLI and Provider Versions
Terraform 0.14.6
hashicorp/archive v2.2.0
Use Cases or Problem Statement
I wanted to zip a folder and add a single extra file to the archive which is a config file created using the templatefile function. If I can add the content directly to the zip then I don't need to use the local_file resource, which creates churn at plan time.
I got the error message from
terraform-provider-archive/internal/provider/data_source_archive_file.go
Line 47 in 9562ec2
about source_dir and source conflicting.
I was wondering what the conflict was as I couldn't think what the conflict could be (duplicate filenames seem possible with source too).
Proposal
Adjust validation so source_dir and source can be specified at the same time.
I could imagine it's desirable to create a "source_file" block attribute that contains file include/excludes, and they could be mixed with the current source blocks. That sounds like a lot more work though.
How much impact is this issue causing?
Low
Additional Information
Big benefit of this would be removal of plan churn because the only current way to make this work is to use local_file provider
Code of Conduct
The text was updated successfully, but these errors were encountered: