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

New Code Action: Generate missing required_providers entry #480

Open
radeksimko opened this issue Apr 30, 2021 · 0 comments
Open

New Code Action: Generate missing required_providers entry #480

radeksimko opened this issue Apr 30, 2021 · 0 comments
Labels
enhancement New feature or request providers Functionality related to Terraform providers textDocument/codeAction textDocument/publishDiagnostics

Comments

@radeksimko
Copy link
Member

Current Version

0.16.0

Background

Many users still doesn't seem to use the explicit provider specification via required_providers block, e.g.

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws" # HERE
      version = "~> 3.0"
    }
  }
}

This means LS needs to handle certain edge cases related to "legacy" provider addresses:

Use-cases

Users would benefit from:

  1. knowing that a best practice exists
  2. their config doesn't follow best practice
  3. having an easy way of making the config follow best practice

Attempted Solutions

Point users to documentation, such as https://www.terraform.io/docs/language/providers/requirements.html

Proposal

Help users follow best practice by detecting lack of provider requirements in configuration and offering them to generate the requirements via code action or code lense (not sure what's more appropriate) if they use Terraform 0.13+.

We could also publish diagnostics about this.

@radeksimko radeksimko changed the title Provide a way of generating provider requirements Generate required_providers entry via code action Oct 20, 2022
@radeksimko radeksimko changed the title Generate required_providers entry via code action Generate missing required_providers entry via code action Oct 20, 2022
@xiehan xiehan added the providers Functionality related to Terraform providers label Apr 21, 2023
@radeksimko radeksimko changed the title Generate missing required_providers entry via code action New Code Action: Generate missing required_providers entry Dec 20, 2023
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 textDocument/codeAction textDocument/publishDiagnostics
Projects
None yet
Development

No branches or pull requests

2 participants