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

Enhance initial out of the box experience (functionality available without terraform init) #737

Open
radeksimko opened this issue Aug 12, 2021 · 0 comments

Comments

@radeksimko
Copy link
Member

Problem Statement

Historical Context

With extension v2 and initial release of the language server the expected end-user workflow was that user would run terraform init to allow the language server to obtain all the metadata to use for completion, hover etc.

This does not represent a great "out-of-the-box experience" given that the extra step is not obvious to many users and even if it is, init will require the user to have valid config and access to any remote state at the time of init both of which add even more steps before the user can actually craft code.

We initially attempted to notify the user about this requirement via popup, which many users (rightly) found distracting and the popup was eventually removed in 0.16.0 as we also built a cache which holds schema for the latest versions of all official + partner providers (~150) at the time of the release.

See hashicorp/terraform-ls#354 and hashicorp/terraform-ls#424

Today

Most users receive reasonable "out of the box" experience thanks to the pre-built schema (without having to run init).

Many users can however still often experience many inaccuracies or entirely missing data depending on what versions of what providers do they use, unless they run init as part of their day-2-day workflow.

Less user-visible impact

The model of us pre-building schema for 150+ providers also doesn't scale very well (currently adds around 6-7 minutes to every release of LS which will only increase with more providers with the whole schema JSON having ~30MB) and we can't really apply the same approach to community providers.

Expected User Experience

Happy Path

User will be provided with all provider-dependent features using accurate data, such as

  • completion within provider, resource or data blocks
  • hover over any elements within provider, resource or data blocks
  • go-to-references of resource or data blocks
  • go-to-definition of resource or data blocks
  • semantic highlighting of provider, resource or data blocks

as long as they use providers published in the Terraform Registry and have access to internet at the time of editing configuration.

Unhappy Path

User will be provided with a hint in the status bar that required Terraform version is not installed and will have option to install the latest Terraform version matching the requirement.

User will be provided with contextual code action to install a provider if no schema is found. The code action will be attached to the relevant provider, resource or data blocks and also to the relevant entry in required_providers block.

Proposal

Resolving these would also improve pre-init experience but it might be a stretch:

Blocking Upstream Work

  • Persisted and exposed provider schema via Terraform Registry API
  • Targeted terraform init per provider in Terraform CLI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants