Comments (5)
Thanks, that workaround fixes this for me!
from terraform-provider-archive.
I have a similar or the same issue.
I am creating a zip file for a Lambda with code like this:
data "archive_file" "my_lambda_zip" {
type = "zip"
output_path = "${path.root}/.terraform/tmp/my_lambda.zip"
source_file = "${path.module}/my-src.js"
}
The "my-src.js" file is a regular file in git:
$ git ls-files -s my-src.js
100644 8ef1d00576701a5cbd7c07c0f5496131b4554b43 0 my-src.js
On unix, the output of the "archive_file" is a zip containing a 644 / "-rw-r--r--" file:
$ zipinfo my_lambda.zip
Archive: my_lambda.zip
Zip file size: 1064 bytes, number of entries: 1
-rw-r--r-- 2.0 unx 2001 bl defN 49-Jan-01 00:00 my-src.js
1 file, 2001 bytes uncompressed, 876 bytes compressed: 56.2%
On windows, the file permissions are different:
zipinfo my_lambda.zip
Archive: my_lambda.zip
Zip file size: 1064 bytes, number of entries: 1
-rw-rw-rw- 2.0 unx 2001 bl defN 49-Jan-01 00:00 my-src.js
1 file, 2001 bytes uncompressed, 876 bytes compressed: 56.2%
This causes Terraform to unnecessarily mark the Lambda as changed, as I am using "filebase64sha256" on the zip, which differs by this one byte.
How can I persuade archive_file to generate a 644/"-rw-r--r--" file on Windows (or indeed a 666/"-rw-rw-rw-" file on Unix)?
Thanks
from terraform-provider-archive.
It looks like the code that handles this reads the file perms using Go's "os.stat" at archiver.go:28 and hands that file mode off directly to Go's zip.FileInfoHeader at zip_archiver.go:56.
According to this blog, Go will always report either 666 or 444 file mode on Windows. Whereas the actual permissions on unix are typically 644.
So without a windows-specific workaround to archive_file, I will need to arrange for my file to be 666 on unix to make my builds consistent cross-platform.
from terraform-provider-archive.
It looks like git won't allow me to make the file 666 mode, only 644 or 755 (cite).
So I'm going to struggle to get this to behave the same on unix and windows without some kind of helper script
from terraform-provider-archive.
The workaround in #90 has been released in terraform-provider-archive v2.2.0. If output_file_mode
does not solve your problem, please comment on this issue or open a new one.
from terraform-provider-archive.
Related Issues (20)
- Migrate to terraform-plugin-framework HOT 1
- Run archive_file on each apply HOT 2
- data.archive_file does not support resource tainting HOT 2
- Bump Development/Build Minimum Go Version to 1.17 HOT 2
- Issue archiving base64 encoded content w/ source block HOT 5
- Bump Expected Minimum Go Version to 1.18 HOT 1
- archive_file doesn't re-create the archive upon content change
- Source_dir conflicts with source HOT 1
- Zip file created by terraform archive_file cannot be properly read by python
- Generated archive contents include an extra (empty) file when `output_path` is configured within same directory as `source_dir`. HOT 2
- Migrate acceptance testing to terraform-plugin-testing HOT 1
- Bump Expected Minimum Go Version to 1.19 HOT 1
- GitHub Actions - deprecated warnings found - action required! HOT 2
- archive_file data source gets created during "terraform plan" vs "terraform apply" and also is not deleted during destroy HOT 10
- Error generated during the execution of acceptance test on archive_file resource
- Documentation and changelog require updating HOT 1
- Support Additional Compression Types(Ex: tar.gz format) HOT 4
- Update Go Module to Go 1.20 Minimum HOT 1
- archive_file produces a corrupted zip file HOT 5
- Error generating archive with archive_file when symlink is present and exclude_symlink_directories is set to true HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-archive.