-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Unreadable module directory when module is .tbz2 archive #36080
Comments
Hey @mkyc, Thanks for reporting this! Based on our documentation on module sources and supported archives (https://developer.hashicorp.com/terraform/language/modules/sources), I'd expect your use case to be valid and working. I'm able to reproduce your issue using: module "example" {
source = "s3::https://36080.s3.us-west-2.amazonaws.com/example.tbz2"
} From a quick look, it seems that Terraform is successfully downloading the archive into the 2024-11-22T18:27:33.851+0100 [TRACE] ModuleInstaller: installing child modules for . into .terraform/modules
2024-11-22T18:27:33.851+0100 [DEBUG] Module installer: begin example
2024-11-22T18:27:33.851+0100 [TRACE] ModuleInstaller: example is not yet installed
2024-11-22T18:27:33.851+0100 [TRACE] ModuleInstaller: cleaning directory .terraform/modules/example prior to install of example
2024-11-22T18:27:33.851+0100 [TRACE] ModuleInstaller: example address "s3::https://36080.s3.us-west-2.amazonaws.com/example.tbz2" will be handled by go-getter
Downloading s3::https://36080.s3.us-west-2.amazonaws.com/example.tbz2 for example...
2024-11-22T18:27:33.851+0100 [TRACE] getmodules: fetching "s3::https://36080.s3.us-west-2.amazonaws.com/example.tbz2" to ".terraform/modules/example"
2024-11-22T18:27:34.809+0100 [TRACE] ModuleInstaller: example "s3::https://36080.s3.us-west-2.amazonaws.com/example.tbz2" was downloaded to .terraform/modules/example
2024-11-22T18:27:34.809+0100 [DEBUG] Module installer: example installed at .terraform/modules/example It seems the download is successful, but something further down the line is causing an issue. I noticed the downloaded archive is missing a file extension, which is causing the “Unreadable module directory” error diagnostic to surface. $ tree .terraform
.terraform
└── modules
├── modules.json
└── example FWIW, uploading a copy of my archive, using a tar.tbz2 extension seems to work. - source = "s3::https://36080.s3.us-west-2.amazonaws.com/example.tbz2"
+ source = "s3::https://36080.s3.us-west-2.amazonaws.com/example.tar.tbz2" It’s possible that the documentation references the For clarity and to avoid confusion:
In go-getter, the library Terraform uses to download files and directories from various sources, there is a decompressor for tar archives compressed with bzip2 that can handle both tbz2, tar.tbz2 and tar.bz2 files[²]. It seems we may have overlooked support for the tbz2 archive extension, causing the fetching process (via the getter) to succeed but leading to a decompression failure. This results in an unexpected file without an extension. I’ll provide an update here as soon as I have more information. Thanks again! |
Hi @bschaatsbergen, thanks for solid investigation! I think you ticked all the boxes with your explanation 👍 |
Terraform Version
Terraform Configuration Files
irrelevant
Debug Output
irrelevant
Expected Behavior
Actual Behavior
I moved some of my modules to S3 as they can be served from there as described here.
As described archive can be of different extension as described in section above.
But when archive is in .tbz2 it doesn't work. With zip it's ok.
Steps to Reproduce
there is file:
and it is archive because I can extract it manually, but it doesn't get extracted by terraform.
With zip it works.
Additional Context
content of those two packages:
References
No response
The text was updated successfully, but these errors were encountered: