VladRassokhin/intellij-hcl

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

fnkr opened this issue · 2 comments

fnkr commented

Prerequisites

  • Ensure you have latest version of plugin installed
  • Search for possible issue duplicates

Installation details

  • IDE version (Help->About->Copy to Clipboard): 2021.3.3
  • intellij-hcl plugin version (Settings->Plugins): 0.7.15
  • Terraform version (terraform -v): 1.1.7

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.

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"
    }
  ]
}

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