VladRassokhin / intellij-hcl

HCL language support for IntelliJ platform based IDEs
Apache License 2.0
244 stars 47 forks source link

ideally distinguish computed properties from others #249

Closed mdaniel closed 5 years ago

mdaniel commented 5 years ago

Prerequisites

Installation details

Terraform Configuration Files

provider "random" {
  version = "~> 2.2"
}
resource "random_string" "rnd" {
  length = 1
  result = "NOPE"
}

Expected Behavior

The completion dialog should understand that some properties (such as random_string.result) are computed and thus should not offer it for assignment in that context, and ideally would not tolerate it appearing in a block even if the user copy-pasted it there image

Failing to offer it for assignment would be a huge win, detecting it after the fact would be a nice-to-have

Actual Behavior

Error: "result": this field cannot be set

  on foo.tf line 5, in resource "random_string" "rnd":
   5: resource "random_string" "rnd" {

Steps to Reproduce

  1. Type the name of a computed property inside a resource block
  2. Invoke completion
  3. Observe the computed property is offered for completion
VladRassokhin commented 5 years ago

Fixed, will be available in 0.7.7. Non-configurable properties won't be advised in completion. Will add inspection later.