VladRassokhin / intellij-hcl

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

Variable Interpolation False Positive #214

Closed ghost closed 5 years ago

ghost commented 5 years ago

Installation details

When I use variable interpolation within a string, the plugin inspection generates a weak warning:

Example Code:

resource "aws_vpc" "this" {
  cidr_block           = "10.130.0.0/19"
  enable_dns_hostnames = true

  tags = {
    Name = "${local.env}.VPC"       # <--- This line generates the warning.
  }
}

Inspection Results:

Interpolation could be replaced with HCL2 expression
Inspection info: Converts to HCL2 expressions

Expected Behavior

To the best of my knowledge, when defining a variable with a string, you must still use ${} syntax.

Actual Behavior

This approach is marked as a warning as it doesn't appear the plugin sees the additional text within the quotes. A workaround in the interim is to write it as Name = local.env + ".VPC" though that is kind of ugly.

Thanks! Tom

VladRassokhin commented 5 years ago

Please search for duplicates first. Duplicates #212