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.

Terraform HCL2: dynamic resource doesn't work properly

See original GitHub issue

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.1.3 (Community Edition)
Build #IC-191.7479.19, built on May 28, 2019
JRE: 1.8.0_202-release-1483-b58 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.5
  • intellij-hcl plugin version (Settings->Plugins)
v0.7.3,v0.7.4
  • Terraform version (terraform -v)
0.12.2

Terraform Configuration Files

resource "aws_codebuild_project" "default" {
  name        = local.project_name
  description = local.project_description

  dynamic "source" {
    for_each = [local.source_code]
    content {
      buildspec           = lookup(source.value, "buildspec", null)
      git_clone_depth     = lookup(source.value, "git_clone_depth", null)
      insecure_ssl        = lookup(source.value, "insecure_ssl", null)
      location            = lookup(source.value, "location", null)
      report_build_status = lookup(source.value, "report_build_status", null)
      type                = source.value.type

      dynamic "auth" {
        for_each = lookup(source.value, "auth", [])
        content {
          resource = lookup(auth.value, "resource", null)
          type     = auth.value.type
        }
      }
    }
  }
...
}

Expected Behavior

It should show the resource normally, but it shows it highlighted (like when we add an external module). I’ve uploaded an image with an example.

When I run terraform apply it works just fine.

Actual Behavior

Screenshot 2019-06-21 at 21 41 47

Steps to Reproduce

  1. Add a resource.
  2. Inside the resource, add a dynamic block.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hugo-paredescommented, Aug 5, 2019

Hi @VladRassokhin On my side it’s working fine now 👍

0reactions
alexejkcommented, Aug 4, 2019

Its on the aws_launch_template in my case. But yes it’s nested under several sub blocks.

Thanks for fixing it so fast! Really useful plugin for me (and much more powerful than VSCode one).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing HashiCorp Nomad 1.0 Beta
Dynamic Application Sizing monitors Nomad jobs, tracks their resource usage, and right-sizes applications to their most efficient levels of ...
Read more >
hashicorp-terraform/Lobby - Gitter
I have a data block that returns a list of data [foo1, foo2, foo3] and I need to loop this list and run...
Read more >
lablabs/label/null - Terraform Registry
Terraform module designed to generate consistent names and tags for resources. Use terraform-null-label to implement a strict naming ...
Read more >
Terraform v0.12 Multi-line String EOF shell-style "here doc ...
The correct syntax for a "flush heredoc" does not include a dash on the final marker: aws_key_path = <<-EOF #{martinTestPrivateKey} EOF.
Read more >
SweetOps #terraform for December, 2020
Terraform currently does not have a lifecycle attribute for retaining such resources. We are curious as to whether or not retaining resources is ......
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