vscode-terraform: `tags = {` breaks syntax highlighting

Not sure if this belongs here or at hashicorp/terraform-ls, but the following block appears to break any subsequent stanzas:

resource "aws_instance" "test" {
  tags = {
    A = "thisisfine"
    B = "this is not fine"
    C = "neither.is.this"
  }
}

resource "aws_instance" "test2" {
    tags = {}
}

Expected result:

Proper syntax highlighting with "this is not fine" and "niether.is.this" being highlighted as strings and the next block being highlighted normally.

Actual Result:

example tf — phishtank-infra 2020-08-20 17-01-03

Removing only B = or C = lines still gives a broken block, each of those lines appears to break the parser. Removing both lines and never having anything but [a-z0-9] in the tag value appears to be the only “fix”.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 33
  • Comments: 17 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Smells like a regression from #462 (meant to fix #442 which is distressingly similar to this issue)

Line 452 in terraform.tmGrammar.json to be precise. If one would revert this line back to 2.1.1 everything works fine!

We are currently working on a fix for this, but for now the best option is to downgrade. We hope to have a hotfix out as soon as we resolve the issue.