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

Option to disable auto terraform providers schema #645

Open
2 tasks done
uLan08 opened this issue Sep 20, 2021 · 3 comments
Open
2 tasks done

Option to disable auto terraform providers schema #645

uLan08 opened this issue Sep 20, 2021 · 3 comments
Labels
enhancement New feature or request providers Functionality related to Terraform providers

Comments

@uLan08
Copy link

uLan08 commented Sep 20, 2021

Versions

This feature does not yet exist in:

  • the latest version of the extension (below)
  • the latest version of the language server (below)

Extension

v2.14.0

Language Server

Starting terraform-ls 0.19.1

Problem Statement

  • I use aws-vault to store my AWS credentials used by Terraform.
  • I have dozens of Terraform folders in my default vscode workspace
  • aws-vault prompts for a password when accessing the credentials in the keychain.

Now everytime I launch vscode I get spammed by aws-vault asking for my keychain password. I am assuming that this is because the Terraform extension automatically runs terraform init in the background.
Screen Shot 2021-09-20 at 11 31 56 AM

This is normally not a problem as this is an expected behavior with aws-vault, I don't mind entering a password when I run terraform init in my day to day work.

Expected User Experience

I should be able to disable the automatic running of terraform providers schema via some configuration.

Proposal

References

@radeksimko radeksimko changed the title Option to disable auto terraform init Option to disable auto terraform providers schema Sep 20, 2021
@radeksimko
Copy link
Member

Hi @uLan08
We do not actually ever run terraform init automatically, but we do run terrafom providers schema -json which is used to obtain the "metadata" (schema of providers) which can then be used to provide accurate completion, hover and other functionality.

There are some trade-offs to consider when disabling this, but there are certainly users which never even run this command and we account for that possibility to some extent by pre-building the latest versions of schemas for ~200 official+partner providers (which includes AWS).

With that in mind I agree that it may be useful to have an option to disable local sourcing of the schema.

I have just modified your original issue to reflect some of the above and I'm transferring it to the language server repository as it's LS executing this command, which this extension uses, so that's where we can implement this.

@radeksimko radeksimko transferred this issue from hashicorp/vscode-terraform Sep 20, 2021
@radeksimko radeksimko added the enhancement New feature or request label Sep 20, 2021
@uLan08
Copy link
Author

uLan08 commented Sep 20, 2021

Oh I see...

but there are certainly users which never even run this command and we account for that possibility to some extent by pre-building the latest versions of schemas for ~200 official+partner providers (which includes AWS)

To clarify, code completion will still be functional even if we disable running of terrafom providers schema -json in the background?

@radeksimko
Copy link
Member

radeksimko commented Sep 20, 2021

To clarify, code completion will still be functional even if we disable running of terrafom providers schema -json in the background?

This is due to the pre-built schemas I mentioned. We fall back to this pre-built source when schema cannot be obtained locally. This currently covers 185 providers listed here: https://registry.terraform.io/browse/providers?tier=official%2Cpartner

The downside of this approach is that these schemas may not match with the provider versions you actually use in your configuration or you may just use a provider that isn't in this group of 185.

For example, the latest version of aws provider is 3.59.0 currently, but you may be using 3.10.0 or even 2.0.0 which can make completion and other data more or less (depending on the delta) inaccurate.

We pre-build these schemas automatically at release time of the language server, but we don't cut releases every day to account for all changes in all 185 providers which occur probably almost every day. 😅

We plan to develop a more sustainable solution described in hashicorp/vscode-terraform#737 and #193

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

No branches or pull requests

3 participants