Skip to content
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

Extend earlydecoder to decode module calls #106

Merged
merged 3 commits into from
May 3, 2022
Merged

Conversation

dbanck
Copy link
Member

@dbanck dbanck commented Apr 28, 2022

This PR addresses the first part of hashicorp/terraform-ls#882 and extends the earlydecoder to decode module calls inside a Terraform file.

Decoded module calls are stored in module.Meta for consumption by terraform-ls.

We're only decoding the source and version attribute of a module block and don't resolve/fill the Path attribute of a ModuleCall.

dbanck added 3 commits April 28, 2022 12:26
This will allow decoding modules blocks and their source and
version attributes
This adds moduleCalls as a new field to Meta and extends the
decoder to return the decoded module calls.
@dbanck dbanck added the enhancement New feature or request label Apr 28, 2022
@dbanck dbanck requested a review from a team April 28, 2022 11:04
@dbanck dbanck self-assigned this Apr 28, 2022
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@@ -23,6 +23,7 @@ type decodedModule struct {
DataSources map[string]*dataSource
Variables map[string]*module.Variable
Outputs map[string]*module.Output
ModuleCalls map[string]*module.ModuleCall
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map is a reasonable structure for hashicorp/terraform-ls#598 and hashicorp/terraform-ls#725 but I'm guessing that unnamed modules may also be helpful to parse in the context of hashicorp/terraform-ls#869 - so we might end up turning this map into slice.

One could make the same argument about entries within the required_providers block. 🤔

Something we can revisit later...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants