0

In a GitLab pipeline I create a virtualenv, install my dependencies, and zip the result. The resulting zip is used in Terraform to be deployed as an AWS Lambda. This all works at the moment. But now, everytime I run my pipeline, Terraform states that the hash of the zip changed, and it want to redeploy the lambda. It had to do with the fact that the filebase64sha256 of the zip had changed.

If you zip one file, and you zip another file with the same contents, those two zips or their hashes do not equal. In a GitLab pipeline the files from the repository are refetched everytime a pipeline runs, therefore having different files, same contents.

Can you help me create identical hashes for zip with files of identical content?

I tried using zip -X, but this does not seem to have any effect.

Also, I looked into other ways of deploying a AWS Lambda using Terraform, for example using S3 buckets, but there the same problem occurs: how does Terraform know the contents of the zip stayed the same to update the file in S3?

broodjetom
  • 276
  • 1
  • 11
  • 3
    Does [this answer your question](https://stackoverflow.com/questions/9714139/why-does-zipping-the-same-content-twice-gives-two-files-with-different-sha1)? – Paul M. Oct 29 '21 at 16:11
  • 1
    Does this answer your question? [Why does Zipping the same content twice gives two files with different SHA1?](https://stackoverflow.com/questions/9714139/why-does-zipping-the-same-content-twice-gives-two-files-with-different-sha1) – aneroid Oct 31 '21 at 20:41

0 Answers0