-
Notifications
You must be signed in to change notification settings - Fork 138
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
Fix module calls command for remote modules #872
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding the bug and raising a PR to fix it! 🙏🏻
I'm wondering if we should improve our testing strategy around the data in .terraform
and have some E2E tests which generate modules.json
and other files with the latest Terraform and run that nightly or something... Certainly not something I'm asking you to do as part of this PR - just thinking out loud.
Given that we need to support older versions of Terraform too (< 1.1.0), I think we should keep testing for the old format and ensure that is still handled correctly. I guess that also means using something like strings.HasPrefix(...) || tfregistry.ParseRawProviderSourceString(...)
for the detection?
Ideally a future tfregistry.ParseRawModuleSourceString
would account for both cases, but I'm not sure how much effort it would be to implement that. Last time I checked TF core, it didn't look as trivial as I hoped and there were some edge cases.
Thanks for your review! I've reverted some changes to keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question about tests - otherwise LGTM
@@ -18,7 +18,7 @@ func Test_parseModuleRecords(t *testing.T) { | |||
records: []datadir.ModuleRecord{ | |||
{ | |||
Key: "ec2_instances", | |||
SourceAddr: "terraform-aws-modules/ec2-instance/aws", | |||
SourceAddr: "registry.terraform.io/terraform-aws-modules/ec2-instance/aws", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding this as a separate test case, e.g. Test_parseModuleRecords_v1_1
? Just to make sure we keep testing for both old and new format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an entry in our test table below for terraform-aws-modules/eks/aws
,but I can create a separate test case as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for the quick turn around!
This functionality has been released in v0.27.0 of the language server. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
With the release of Terraform 1.1.0 module source addresses are now stored normalized:
With this change it's not possible anymore to identify remote modules using
ParseRawProviderSourceString
.This PR updates the module source detection for remote modules and with this reenables 'Open Documentation' and displays the correct icon in the extension UI.
Before
After