tofu-controller icon indicating copy to clipboard operation
tofu-controller copied to clipboard

Python Dependency Error with tf-controller

Open jmuma1 opened this issue 2 years ago • 2 comments

Python Dependency Error with tf-controller

  • I am trying to [terraform apply] a resource via the tf-controller wherein the main.tf for the resource uses an aws lambda module, which uses python to package the lambdas.
  • I customized my Dockerfile to have python installed within the tf-controller image and redeployed
  • Now, I get this apply error [File "/usr/lib/python3.11/zipfile.py", line 548, in from_file │ │ zinfo = cls(arcname, date_time) │ │ ^^^^^^^^^^^^^^^^^^^^^^^ │ │ File "/usr/lib/python3.11/zipfile.py", line 390, in init │ │ raise ValueError('ZIP does not support timestamps before 1980') │ │ ValueError: ZIP does not support timestamps before 1980 ]

image

  • I found this command being used to update timestamps and resolve the issue: [touch find . -type f]. I modified it to fit my use case, added it to a bash script and customized the tf-controller image with it.
  • After redeployment, I exec into the pod to confirm the .sh script is in there. However, I still get the same apply error. To make sure, I exec into the pod once and run the modified [touch find . -type f] and confirm it updates the timestamp. But for some reason, during the terraform plan/apply via the tf-controller, the error is the same
  • I even modified the module in main.tf by equating the 'commands' argument with the modified [touch find . -type f] but get the same error
  • It seems like the [terraform apply] is trying to reach a file somewhere within the aws lambda module that leverages python, but that file(or files) does not have a supported timestamp, OR a timestamp at all (Hence the error message stating "ZIP does not support timestamps before 1980"
  • My best guess is that there is something about the tf-controller that makes it not naturally compatible with the python timestamp thing. Explaining why when doing a regular local terraform plan/apply, this error message does not pop up
  • Has anyone ran into this?
  • Any Thoughts/Suggestions will be appreciated

jmuma1 avatar Sep 08 '23 21:09 jmuma1

Note: It looks like some files have a modification date of 1970-01-01 (and most likely 01:00:00 for time).

yitsushi avatar Jan 05 '24 04:01 yitsushi

I had exactly the same issue using the latest version 0.16.0-rc.4 We are using Terraform Cloud with workspace cli / remote Is there any progress on this issue? This is easily repeateble. There must be a way to "touch files" with the current date.

rlaflamme avatar Oct 04 '24 15:10 rlaflamme