-
Notifications
You must be signed in to change notification settings - Fork 131
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
Replace internal decoder with hcl-lang #281
Conversation
2e18a13
to
476f67f
Compare
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.
Overall approve, but a pairing session will go a long way for me I think
611622a
to
ffe4936
Compare
One potential bug was discovered, or at least an untested scenario during our call with @appilon where user requests completion in a file (or performs any other operation requiring schema) within a module that was not initialized. We need to make sure that the relevant schema is matched. AFAIK the current behaviour is just to provide reduced completion candidates (without any provider schema), which is incorrect. This scenario is tested in some other contexts here: I will need to look into this. |
This is not the cleanest solution, but it serves the interest in integrating hcl-lang & terraform-schema. Some refactoring in the rootmodule package is certainly due by now.
ffe4936
to
56a5593
Compare
That bug was addressed in the last commit I believe, it wasn't actually that trivial, but I tried my best to avoid changing too much code, given how much is already being changed. That said I think some of the Basically the key change this PR is introducing is that what we previously understood as "root module" was a module that is always So at the very least the naming should probably change from "root modules" to "modules", but I'd prefer to leave that for another PR. |
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. |
End-User Impact
The implementation generally enables a "progressively enhanced" experience. In practice this means:
resource
,data
, andprovider
for now, but we can expand later)terraform version
ran)terraform providers schema -json
ran)data.random_string.refname
) but a block is represented the same way it would be in config (e.g.data "random_string" "refname"
). This prevents any confusion when displaying "unreferable" blocks or attributes such asterraform
and allows us to load symbols early, before any schema (which would define the addressing scheme) is available.Implementation Notes
sourcegraph/go-lsp
library doesn't have the right type to expose this, so I left enabling this for another PRhcl-lang
andterraform-schema
. The main "plumbing point" is basicallyRootModule
methods.Future
This makes it easier to solve the following issues:
variable
blocks #122output
blocks. #123It should be mostly (ignoring RHS completion which isn't supported at all yet) a matter of adding the appropriate schema to
hashicorp/terraform-schema
and bumping the dependency here.Additional Links
https://github.com/hashicorp/hcl-lang
https://github.com/hashicorp/terraform-schema