Skip to content
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

Zip file created by terraform archive_file cannot be properly read by python #172

Open
1 task done
GaryLiuTelus opened this issue Dec 22, 2022 · 0 comments
Open
1 task done
Labels

Comments

@GaryLiuTelus
Copy link

GaryLiuTelus commented Dec 22, 2022

Terraform CLI and Provider Versions

Terraform 0.14.9

Terraform Configuration

The code is as below

data "archive_file" "utilities_zip" {
    type = "zip"
    source_dir = "./source/utilities"
    output_path = "/tmp/utilities.zip"
}

The folder structure of utilities:

/source/utilities
--dsa/
----test.py
----xxx/
-------abc.py



### Expected Behavior

The following python code should go through: 

```python
import sys
sys.path.insert(1, "/tmp/utilities.zip")

from dsa import test

Actual Behavior

Got below error:

ModuleNotFoundError: No Module named 'dsa'

If unzip the zip file and rezip using 7-zip, or zip the folder using zip -r /tmp/utilities.zip dsa command, the above python code can run without any issues.

Steps to Reproduce

  1. create a folder containing some python file
  2. zip folder with terraform
  3. terraform apply
  4. try to refer and import python file from zip file.

How much impact is this issue causing?

High

Logs

No response

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant