VladRassokhin / intellij-hcl

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

Add support for dynamic blocks #391

Closed luis-guimaraes-exoawk closed 2 years ago

luis-guimaraes-exoawk commented 2 years ago

Prerequisites

Installation details

Kotlin: 221-1.6.21-release-337-IJ5591.52 Current Desktop: KDE

 - [x] intellij-hcl plugin version (`Settings->Plugins`)
`221.5591.19`
 - [x] Terraform version (`terraform -v`)
```text
Terraform v1.2.0
on linux_amd64

Terraform Configuration Files

resource "aws_db_parameter_group" "demo" {
  name   = "mysql-demo"
  family = "mysql5.7"

  dynamic "parameter" {
    for_each = local.rds.conditions.db_parameters
    content {
      name  = each.value.name
      value = each.value.value
    }
  }
}

image

Exception

The "each" object can be used only in "resource"/"data"/"module" blocks, and only when the "for_each" argument is set

Expected Behavior

It should recognize the values correctly

Actual Behavior

It doesn't recognize valid values

Steps to Reproduce

  1. Create a dynamic block with a for_each and check that values are not recognized inside the content block