Closed apparentlymart closed 6 years ago
Looking at this again today with fresh eyes, I see my mistake: I somehow concluded that it was v1.1.0 of the module that was getting that error, but looking again at the screenshot I see it was v1.0.0.
And indeed one of the differences between v1.0.0 and v1.1.0 is a change that would make this parse successfully in the old parser, so it was my choice of the wrong version that caused me to not be able to reproduce here.
For future reference: the behavior of the registry at the time of writing is to attempt parsing both both with the old and new versions of HCL. If both fail, then it prefers to return the error from the new version, which is what was shown in the screenshot here. If either one succeeds then the new version takes priority over the old. Since the registry only cares about top-level metadata, the result of both parsers should be the same if they both succeed.
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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Over in hashicorp/hcl2#35, @bhushan-rane reported getting an import error from the public module registry that included an error message produced by the new HCL parser.
This module (version v1.1.0) is targeting current Terraform versions, and includes some constructs that will no longer be valid in the next major release. However, the registry should've been able to parse this successfully using the old (that is, current) parser.
I ran the parsing code that the registry uses (the library code directly, excluding any code in the registry application itself) and got a successful result, indicating that it used the correct parser:
It would seem, then, that something else went wrong in the registry application code that caused it to fail to parse using the "HCL1" parser and thus fall back on returning the errors from the "HCL2" parse. This is confusing, because the automatic dual version handling is handled within the library I ran here, and not within the registry itself.