terraform-provider-archive
terraform-provider-archive copied to clipboard
archive_file changes file timestamps
This issue was originally opened by @rahulinux as hashicorp/terraform#18765. It was migrated here as a result of the provider split. The original body of the issue is below.
Hi there,
When using archive_file, file timestamp set to 00-00-1980. I would really like to use Terraform to zip files but preserve the same permission but I can't.
Tested with Terraform v0.11.8
From what I'm seeing, when I run terraform plan
, archive_file will update the timestamp on the resulting zip file; however, it doesn't actually update the file contents. I verified this manually by running my own checksum comparisons, and each time, the manual checksums are identical. Only the timestamp on the zip file is updated.
Diving deeper, I think this is merely a cosmetic issue, as the file's created date
doesn't appear to be changed; only the modified
date is getting changed on every plan
, which indicates to me that terraform is touching the file every run.
$ GetFileInfo lambda_function_payload.zip
file: "/*********/lambda-chef-node-cleanup/terraform/lambda_function_payload.zip"
type: "\0\0\0\0"
creator: "\0\0\0\0"
attributes: avbstclinmedz
created: 01/08/2019 21:56:25
modified: 01/09/2019 13:53:06
I'm using terraform v0.11.7 and terraform-provider-archive_v1.1.0_x4 at the moment.
Would it be possible to reset the zip file timestamp? Otherwise, we obtain a different md5 on it on every run, even though the contents (incl. the timestamps of the files inside the zip) don't change.
EDIT: Upon further analysis, the difference in my case was not due to the timestamp, but rather due to a file attribute difference.