vscode-terraform icon indicating copy to clipboard operation
vscode-terraform copied to clipboard

Completion for required_providers `source` & `version`

Open radeksimko opened this issue 4 years ago • 0 comments

Problem Statement

Terraform has a rich ecosystem of providers published in the Terraform Registry.

In order to use a provider in Terraform 0.12+, the user has to declare it explicitly, e.g.

terraform {
  required_providers {
    hcs = {
      source = "hashicorp/hcs"
      version = "0.3.0"
    }
  }
}

We provide completion for most of the above, except for the values of source and version. As a result, unless the user is copy-pasting the provider address and/or version they can make a mistake which would be preventable with completion.

Expected User Experience

source

terraform {
  required_providers {
    hcs = {
      source = "# HERE #"
    }
  }
}

Upon typing >= 2 characters, the user will be provided with a list of providers from the Registry matching the typed name. e.g. if they type ad then the following list of 14 providers would come up:

https://registry.terraform.io/search/providers?q=ad

version

terraform {
  required_providers {
    hcs = {
      source = "hashicorp/aws"
      version = "# HERE #"
    }
  }
}

Upon completion, the user will be provided with a list of published versions of a given provider, e.g. in case of hashicorp/aws they will see the following:

  • 3.46.0
  • 3.45.0
  • 3.44.0
  • etc.

Proposal

https://github.com/hashicorp/terraform-ls/issues/871

radeksimko avatar Jun 21 '21 11:06 radeksimko