terraform-provider-archive
terraform-provider-archive copied to clipboard
Zip file created by terraform archive_file cannot be properly read by python
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
- create a folder containing some python file
- zip folder with terraform
-
terraform apply
- 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
- [X] I agree to follow this project's Code of Conduct