-
Notifications
You must be signed in to change notification settings - Fork 60
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
archive_file changes file permissions #10
Comments
Something along the lines of the following works as a workaround...
#!/usr/bin/env bash
set -e
if [[ "$1" != "" ]]; then
DIR="$1"
else
DIR=.
fi
# make sure you have the `-q` flag to not mess with the output JSON
zip -jq ${DIR}/your_zip ${DIR}/your_input_dir
BASE_64_SHA256=$(shasum -a 256 -p ${DIR}/your_zip | base64)
echo "{ \"source_hash\": \"${BASE_64_SHA256}\"}" |
The fix to this is included in v1.0.1 and was released earlier today. |
Inadvertently this broke recently deployed Python scripts for me:
Lambda seems to require world-readable permissions and previous behavior of |
@paultyng should I raise a new issue for this (optional parameter to set perms before archiving)? |
We talked a bit more about it internally, and we are thinking this all potentially may be better on the AWS lambda resource itself, so that instead of S3 or a local zip, you can specify the files right there and it will create a zip with all the necessary settings for Lambda. If you would prefer that functionality, please open that issue on the AWS provider. |
This issue is still occurring on Windows. Within the ZIP file created by |
This issue is still occurring on Mac OS X Catalina with Terraform 0.12.19, using
The original files had This makes custom runtimes in AWS Lambda not work due to permission errors. Is there anyway to reference a zip file without |
Same thing here on Linux. Executable bits are being unset.
|
Fixed this issue by using |
Thanks, @OliverEhrhardt. That worked for me, as well. |
this example definitely suffers from this issue:
this, however, worked fine:
|
Weirdly, I see the file permissions to be preserved, but I would like them to become 644 (so that the deployment is completely reproducible). Would it be possible to add an optional flag to set file permissions via |
Yup, this is not happening on my Mac, but it is happening on our CentOS build server and it it's driving me bonkers. |
I had no issue with file permissions when I used |
The workaround in #90 has been released in terraform-provider-archive v2.2.0. If |
The tf worked in development but was running across
|
When I experimented with other chmod values that do not grant execution, e.g. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This issue was originally opened by @cbarensfeld as hashicorp/terraform#16598. It was migrated here as a result of the provider split. The original body of the issue is below.
When using archive_file, file permissions are set to 644 regardless of the original permissions. Is this by design? I would really like to use Terraform to zip up my Lambda function, but since I am using a binary, which needs to be executable, I can not.
https://www.terraform.io/docs/providers/archive/d/archive_file.html
The text was updated successfully, but these errors were encountered: