VladRassokhin / intellij-hcl

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

"Argument names must not be quoted" when argument names must be quoted #385

Open fnkr opened 2 years ago

fnkr commented 2 years ago

Prerequisites

Installation details

Terraform Configuration Files

resource "helm_release" "this" {
  dynamic "set" {
    for_each = var.foo ? {
      "foo.bar" = "foo"
      "bar.foo" = "bar"
    } : {}
    content {
      name  = set.key
      value = set.value
    }
  }
}

Expected Behavior

The linter should not produce any warnings for this Terraform code.

Actual Behavior

The linter complains that "argument names must not be quoted" even through argument names can be quoted here. In fact, in this case the opposite is true. I must use quotes here since my argument names contain "." and Terraform would evaluate those as variables without the quotes.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Create a new "HashiCorp Configuration Language" scratch file.
  2. Paste the code example from above.
graphicdeveloper commented 2 years ago

FYI, the same linter warning fires in WebStorm with string interpolation - it would be sweet if this could be fixed. :-)

The key name "FOO_${i}" gets the same red underline (and dropdown) as your screenshot above (although the code itself actually works just fine):

locals {
  my_list = [
    for i in range(3) : {
      "FOO_${i}" = "BAR"
    }
  ]
}
jeffery commented 1 year ago

I am using version 223.8214.6 of the plugin and this issue still exists