VladRassokhin / intellij-hcl

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

for_each and each.value properties should be recognized #267

Open eservent opened 5 years ago

eservent commented 5 years ago

Thank you for opening an issue. In this template paragraph text could be removed, however please retain headers.

Prerequisites

Installation details

Terraform Configuration Files

locals {
  dms_source_endpoints_list = {
    accounting : {
      enable : true
      database_name : "database_name"
      server_name : "server_name"
      port : 5432
      engine_name : "postgres"
      username : "username"
      password : "password"
    },
    bank : {
      enable : false
      database_name : "database_name"
      server_name : "server_name"
      port : 5432
      engine_name : "postgres"
      username : "username"
      password : "password"
    },
  }
}

resource "random_string" "endpoint_password" {
  length  = 16
  special = false
}

resource "aws_dms_endpoint" "source_db_endpoints" {
  for_each = {for k, v in local.dms_source_endpoints_list : k => v if v.enable}

  endpoint_type = "source"
  endpoint_id   = replace("dmse-${var.environment}-${var.product_name}-${each.key}_rds_source", "_", "-")
  database_name = each.value.database_name
  server_name   = each.value.server_name
  port          = each.value.port
  engine_name   = each.value.engine_name
  username      = each.value.username
  password      = random_string.endpoint_password.result

  ssl_mode = "require"

  tags = merge(
  {
    "Name" = "dmse-${var.environment}-${var.product_name}-${each.key}_rds_source"
  },
  )
}

Exception

No exception

Expected Behavior

Should recognize, or at least not error, properties inside each.value like each.value.database_name. Behavior should be same as if "for_each = local.dms_source_endpoints_list", but it defers when we use for expression.

Actual Behavior

Each property (database_name, port, etc.) appear as an error (like missing property).

Steps to Reproduce

Just copy/paste in IntelliJ

gleichda commented 4 years ago

Can still verify this issue even after using 0.7.9 where #261 was fixed.

IDE version

IntelliJ IDEA 2020.1.1 (Ultimate Edition)
Build #IU-201.7223.91, built on April 30, 2020
Licensed to Media Saturn IT-¬Services GmbH / David Gleich
Subscription is active until October 1, 2020
Runtime version: 11.0.6+8-b765.40 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
GC: ParNew, ConcurrentMarkSweep
Memory: 989M
Cores: 8
Non-Bundled Plugins: com.intellij.plugins.watcher, org.intellij.plugins.hcl, name.kropp.intellij.makefile, BashSupport, org.jetbrains.plugins.go, org.jetbrains.plugins.ruby

HCL Plugin: 0.7.9

Terraform Version: v0.12.24

ericaskari commented 4 years ago

This bug still exist.

plugin version: 0.7.10

WebStorm 2020.2.3 Build #WS-202.7660.23, built on September 30, 2020 Runtime version: 11.0.8+10-b944.34 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.7 GC: ParNew, ConcurrentMarkSweep

Screenshot 2020-10-26 at 11 53 59

salokanto commented 3 years ago

It's still an issue. OSX, plugin 0.7.10 (not updated since the previous post almost a year ago).

Screenshot 2021-07-13 at 10 51 47
mycarrysun commented 2 years ago

Still an issue for me as well on v0.7.14

irrelevanti commented 2 years ago

v0.7.15 confirm the issue is still there