-
Notifications
You must be signed in to change notification settings - Fork 135
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
Allow loading of on-disk provider schemas #828
Comments
Hi @tylerFowler For what it's worth we do already support providers which are not embedded into LS, although it comes with some caveats. Ironically, the embedding of provider schemas initially came as a "fallback" to the original method but probably ended up as the primary method of getting schemas for reasons I'll describe below. 😅 The language server will attempt to run The major caveats of obtaining schema via CLI are
The challenge with schemas in separate files isn't as much the clunkiness (although I agree it is clunky) but more that there is 1 schema per provider version, so the interface is more like a filesystem hierarchy or HTTP endpoint, rather than a single file. HTTP endpoint is basically how we plan to integrate with registry.terraform.io API as part of #193 and I expect that the same or comparable API functionality would also be eventually added to TFC API such that we can source schemas even for providers hosted in private registries. The remaining question for private registry is discovery and auth of course, but we have some groundwork available in the On a related note - How do you distribute these internal providers? Would the private registry in TFC help in this situation, if we integrated with a hypothetical future API there? There is also alternative/additional idea described in #355 which involves obtaining the schemas via gRPC, but that has some other challenges as the provider still has to be installed somehow somewhere (and kept up to date). |
Hello, thanks for the reply! As it happens, the caveats you listed to TF CLI based schema discovery do apply to my usecase pretty directly. We don't actually distribute our internal providers to users at all, all actual Terraform operations happen in a controlled cloud setting so developers writing Terraform code never really interact with the tool itself and so do not download providers at all. Hence the need for us to be able to distribute schemas separately. That said, we are also looking into implementing a private registry using the TF protocol, so I'd be very interested in the ability to source schemas from one. Is there a timeline for that feature? |
There is currently no timeline. I can say is that providers in the public registry are generally higher on our priority list but there's a possibility we may end up supporting private registry at least partially as a side effect of solving this for public providers since some parts of the private and public Registry codebase are AFAIK shared at it may end up being just a matter of swapping hostnames. I cannot predict nor guarantee that at this point though. It is relatively unlikely we'll introduce support for loading schema directly from the filesystem - due to the workflow challenges we both described here. If we do introduce some support though it would be more along the lines of loading schemas from a directory with a particular structure, assuming the most pragmatic use case would be schemas available via NFS mount-point (e.g. |
That's fair, after investigating further it appears that if I were to implement a custom private registry, then the I wasn't aware of the |
Current Version
Use-cases
I have a use case where I have a number of org-private providers and would like to be able to distribute schemas for them alongside a base terraform-ls build in order to provide autocomplete support for these internal providers.
Attempted Solutions
A custom fork that embeds a set of schemas that are built out-of-band would not be doable for my usecase given organizational constraints.
Proposal
A simple solution might be to provide a flag to provider schemas on-disk that would augment or override the existing VFS schema store loading process in
internal/schemas
. This would allow us to distribute the schemas separately from the terraform-ls binary and avoid a long-lived fork.For example:
Admittedly having to provide two files is somewhat clunky, ideally the two can be combined into a single file and disassembled in code but I understand if there's opposition to that.
If there is interest in this solution or something like it, I would be interested in contributing such a feature since we need it sooner rather than later.
The text was updated successfully, but these errors were encountered: