-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
'Error: Failed to read module directory' after upgrading to terraform 1.2.7 #31615
Comments
FYI @radeksimko |
Not the same error, but I believe the same problem:
When using https://registry.terraform.io/modules/hashicorp/subnets/cidr/latest In
But |
Solved with: 😅
Totally tongue in cheek but yea, I really had to do this - everything I ran was breaking.
That said, what was really interesting was that I downgrade, ran once and upgraded again and everything worked. This tells me it is exclusive to the downloader portion of the code. |
I haven't done any debugging but I don't see how this could be related to #31573 as that PR touched provider address validation, not module source. I will let someone from the Core team to chime in. |
Problem with I am using the
|
Terraform is totally useless with 1.2.7. Everything breaks |
We experienced the same thing with the |
We are also experiencing the same problem with this module - |
We have similar issue. We use a module from the registry. Unfortunately, the module is downloaded, but the submodules used by that module are not, leading to half the module code not being there. |
Thanks everyone! We are currently investigating the issue. |
Same issue for us running terraform version 1.2.7 and trying to download module terraform-aws-modules/iam/aws/modules/iam-role-for-service-accounts-eks |
The problem appears to have originated from the registry and numerous incorrectly cached responses. Please let us know if there are any modules which continue to exhibit this behavior with v1.2.7. |
I'm still seeing this with the original module I reported?
|
Thanks @pickgr, I'll let them know not all the URLs have been purged. |
Hello, we also have the problem with this module : https://registry.terraform.io/modules/terraform-aws-modules/alb/aws/6.10.0 |
Hi all! Thanks for reporting this incorrect behavior. If you need to use a module that has an incorrect cache entry that hasn't yet been purged, I believe it should work to stay on Terraform CLI v1.2.6 for the moment (since the cached registry responses for that version are still correct) until the modules you need to use have had their caches purged. Please do let us know if you've found a problem with a module that wasn't already mentioned above, though, so we can take full stock of the scope of this when we run a retrospective later. If possible it would be ideal to see exactly what you have in both the As a little additional context about what seems to be going on here, for those who are following along with the details right now now, or those who might find this issue in future and wonder what was going on: Terraform Registry implements the module registry protocol, which is essentially just an indirection over module sources that layers on the idea of there being multiple versions of each logical module. The registry is therefore really just an index of module packages published elsewhere, and doesn't truly host anything itself. For the public Terraform Registry in particular, the "elsewhere" is GitHub repositories, and so when Terraform CLI asks For reasons we're not yet quite sure about, it seems that the registry's CDN cache for certain module versions got "poisoned" with a legacy incorrect URL that doesn't correctly refer to the right directory within the module package. So far it seems that the cached response was an old-style URL to a source tarball on GitHub, and GitHub's source tarballs put the repository content into a subdirectory named after the repository rather than directly in the root, so the subdirectory path for the module mentioned in the leading comment would really be We're still investigating what exactly happened here. At first blush it seems that a backward-compatibility heuristic somehow miscategorized Terraform v1.2.7 as an older version of Terraform requiring a protocol shim, and then that response got cached for certain modules. For the moment we're doing quick mitigation via cache purging but also need to track down the root cause for why the incorrect response had been returned in the first place. We're still looking into the root cause but in the mean time can purge specific modules that have incorrect caches in order to make them work again. |
We see this problem with private modules that are hosted at github and referenced by their github url and tag. Works fine with 1.2.6, broken with 1.2.7 (with similar "An argument named "blah" is not expected here." errors) |
We're seeing this with https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/ since yesterday afternoon.
|
If you are still looking for examples of what was failing...
No |
I know |
I'm still seeing issues with https://registry.terraform.io/modules/terraform-aws-modules/rds-aurora.
|
OK, we located the URLs which were known to be affected, and purging the cache for those is now complete. |
Still not working with our atlantis deploys. Is there some way to tell atlantis to clean its cache directory? Also, why not release 1.2.8 that fixes whatever cache corruption 1.2.7 introduced? |
In this case, the caches being referred to here are the caches Terraform Registry uses to lookup the correct response to a query for a particular module+version. These are all "server-side" from the perspective of a Terraform CLI user. With the caches "purged," they are now returning the correct responses to the queries.
The local Unfortunately, as we do not develop or maintain Atlantis, I do not believe we know how to clear the cache folder for Atlantis. (edit: "we" as in the Terraform Core team). Thanks for your questions! |
I've confirmed everything is working for me with Thanks for the quick turnaround everyone! |
I think my comment above may have created some confusion when considered in conjunction with the other kind of "cache" some are discussing here, so just to clarify: In my case, I was discussing the remote cache living in the CDN that provides the Terraform Registry service. That cache is under the control of our Terraform Registry team and so they are able to proactively purge it; that is what @jbardin was meaning above when he said that we have purged the caches. Terraform CLI, in Since this issue effectively caused the registry to report incorrect subdirectory paths, it seems like some of you now have incorrect subdirectory paths in the local manifest file too. We cannot proactively purge that because it's on your own local computers, but as @pickgr noted one way to deal with it is to run A more "surgical" answer, focusing only on modules, is to delete the |
|
I had tried that, but it seemed to still be poisoning the cache. Or maybe it wasn't 'fixed' yet? |
Closing since the registry issue was resolved and there have been no further incident reports. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
No errors during init.
Actual Behavior
Init failed with error show above.
Steps to Reproduce
terraform init -upgrade
Additional Context
References
I believe this may be related to #31573
Also see the public submodule in the registry at https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest/submodules/vpc-endpoints
Note how there are two backslashes for the path for the source specified in the example.
Unfortunately, I don't have time to dig into it further right now.
The text was updated successfully, but these errors were encountered: