question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

for_each and each.value properties should be recognized

See original GitHub issue

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

Prerequisites

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

Installation details

  • IDE version (Help->About->Copy to Clipboard)
IntelliJ IDEA 2019.2.3 (Ultimate Edition)
Build #IU-192.6817.14, built on September 24, 2019
Runtime version: 11.0.4+10-b304.69 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 976M
Cores: 4
Registry: project.tree.structure.show.url=false
Non-Bundled Plugins: com.github.nokia.pyvenv, Git Scope, com.ppolivka.plugin.gitcleaner, com.sburlyaev.terminal.plugin, gr.jchrist.gitextender, mobi.hsz.idea.gitignore, name.kropp.intellij.makefile, net.seesharpsoft.intellij.plugins.csv, org.intellij.plugins.hcl, izhangzhihao.rainbow.brackets, Pythonid, zielu.gittoolbox
  • intellij-hcl plugin version (Settings->Plugins) 0.7.7
  • Terraform version (terraform -v) 0.12.10 aws 2.33.0

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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:23
  • Comments:5

github_iconTop GitHub Comments

2reactions
irrelevanticommented, Apr 14, 2022

v0.7.15 confirm the issue is still there

2reactions
salokantocommented, Jul 13, 2021

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript not recognizing values set on object within scope ...
First you try to assign unknown keys ( a , b and c ) to your object initSubmissionState , which only knows the...
Read more >
Acces a value property in for each value loop
Solved: Hi guys, I have a scenario that I am retrieving N:N Intersect table data. It returns me all Training ID's from a...
Read more >
PowerShell foreach loops and ForEach-Object - Svendsen Tech
The foreach loop enumerates/processes the entire collection/pipeline before starting to process the block (statement list / code), unlike the pipeline-optimized ...
Read more >
Back to Basics: The PowerShell Foreach Loop
One of the newest foreach loops was introduced in PowerShell v4 called a foreach() method. This method exists on an array or collection...
Read more >
Iteration with the ForEach Element - IBM
The specification file supports a simple ForEach iterator that binds a temporary property to each value in the supplied set in turn. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found