Open
Description
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:
- Terraform Language Server v.0.16.0 keeps crashing after upgrade to v.2.10.1 #479
- Convert legacy provider addresses via Registry API #458
Use-cases
Users would benefit from:
- knowing that a best practice exists
- their config doesn't follow best practice
- 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.