Vscode-terraform: Terraform v0.12.3 - Syntax check broken: Unknown token IDENT

Created on 3 Jul 2019  ยท  29Comments  ยท  Source: hashicorp/vscode-terraform

Throughout our Terraform catalog of modules we are seeing syntax errors for "unknown token IDENT".

Examples:

ident1

ident2

ident3

It's not just local to my machine. Our entire team is experiencing it. We are on TF version v0.12.3.

Most helpful comment

For those who are struggling to make this work a summary of the above:

Adding the following to your settings.json file:

"terraform.languageServer": {
        "enabled": true,
        "args": []
    }

and

"terraform.indexing": {
    "enabled": false,
    "liveIndexing": false
  }

This tells VSCode to turn off the old extension's system and on the new language server system.

Restart VSCode once and it will prompt to download the language server.

Restart again after the install completes (if necessary)

Not saying this is OK or a good dev experience, but the solution in this thread does work. Looking forward to the language server becoming a mainstay :+1:

All 29 comments

This is because of unfinished support for TF 0.12

157

Same here for me for a valid syntax according to v0.12 -
Screen Shot 2019-07-04 at 10 19 03 AM

The only IDE I know that supports TF 0.12+ HCL syntax is Intellij IDEA with the Terraform plugin

This bug still happens in version 1.4.0 with lsp server

Any update on syntax for v.12?

have the same probem

Its really annoying! any fixes or workarounds?

Enable the experimental Terraform language server, which has support for Terraform 0.12...
settings.json

    "terraform.languageServer": {
        "enabled": true,
        "args": []
    }

Enable the experimental Terraform language server, which has support for Terraform 0.12...
settings.json

    "terraform.languageServer": {
        "enabled": true,
        "args": []
    }

@HighwayofLife This looks like it conflicts with this add-in. How do you have yours configured?

Enable the experimental Terraform language server, which has support for Terraform 0.12...
settings.json

    "terraform.languageServer": {
        "enabled": true,
        "args": []
    }

Seems to have worked.

@fluffy-cakes

@HighwayofLife This looks like it conflicts with this add-in. How do you have yours configured?

That is how I have mine configured. You need vscode-terraform 1.4, which added support for Terraform 0.12 via a language server.

Enable the experimental Terraform language server, which has support for Terraform 0.12...
settings.json

    "terraform.languageServer": {
        "enabled": true,
        "args": []
    }

Seems to have worked.

It brought another set of errors when using the "count" value in my TF files unfortunately :(

Language server didn't fix all of these for me. And brought some others. Is there any way to toggle language checking entirely?

Language server didn't fix all of these for me. And brought some others. Is there any way to toggle language checking entirely?

@skupjoe add this bad boy to your settings.json file. I had the same thing going on and decided i was sick of the red in my editor.

  "terraform.indexing": {
    "enabled": false,
    "liveIndexing": false
  }

Worked with a reload thanks!

Shame to leave the indexing support, but I can wait for now. Thanks for the great plugin!

Yep _terraform.languageServer_ and _terraform.indexing_ to false blocks did "green out" my code with terraform 0.12.x syntax features.

@cima How did you get rid of count.index errors?

The problem is still happening. How much time will we have to live with the workaround?

The workaround described actually created more issues than I had originally. Any updates on this would be most appreciated!

For those who are struggling to make this work a summary of the above:

Adding the following to your settings.json file:

"terraform.languageServer": {
        "enabled": true,
        "args": []
    }

and

"terraform.indexing": {
    "enabled": false,
    "liveIndexing": false
  }

This tells VSCode to turn off the old extension's system and on the new language server system.

Restart VSCode once and it will prompt to download the language server.

Restart again after the install completes (if necessary)

Not saying this is OK or a good dev experience, but the solution in this thread does work. Looking forward to the language server becoming a mainstay :+1:

Thank you Mentioum, Issue has been resolved. :-)

Not sure if it's really a good idea. Currently working on gcp provider 3.x versions and I've seen language server latest version install gcp 2.x.

Warnings removed anyway.

I think we all appreciate the effort for basically un-breaking the IDE, but it is true that a lot of "nice" features have been lost. For example, references don't work anymore, there is no link to the documentation anymore, ...

This is not to complain about the work already done (linked to https://github.com/mauve/vscode-terraform/issues/157), but just maybe a reminder...? To be honest, I would gladly help but I'm afraid I don't even know where to look

Last contribution 1 Oct 2019. Is it dead? :(

yea, so I guess we should look for another plugin since this one didn't receive any updates on Terraform syntax since last issue was reported on June 2019...

Enable the experimental Terraform language server, which has support for Terraform 0.12...
settings.json

    "terraform.languageServer": {
        "enabled": true,
        "args": []
    }

@HighwayofLife This looks like it conflicts with this add-in. How do you have yours configured?

Thank you. VS Code suggested I do this, but the information on how was not readily available.

We just released v2.0.0-rc.1 of the extension. The main features include:

  • Added syntax support for 0.12
  • Added terraform-ls usage by default (currently on 0.3.0, which offers basic provider code completion)

You can find additional information and specifics in the release notes and CHANGELOG.

With this release we expect that many of the prior issues and PRs are no longer relevant or have been addressed, and are therefore being closed. If you feel the action taken on an issue or PR is in error, please comment as such and we can figure out the appropriate way to address it.

We plan to add the final 2.0.0 release to the marketplace soon, but are actively seeking your feedback now on the release candidates. You can download the .vsix from the releases page and manually install it in VS Code to try it out.

What a fanastic time on my part to check if there's any progress on this. I just installed the extension manually as mentioned above and the annoyance with faulty syntax highlighting has indeed gone. Thanks for all the hard work @paultyng, @aeschright et al. Looking forward to this becoming mainline in the future.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

okgolove picture okgolove  ยท  4Comments

kagarlickij picture kagarlickij  ยท  5Comments

sugarraysam picture sugarraysam  ยท  4Comments

chrisgallivan picture chrisgallivan  ยท  4Comments

brodster2 picture brodster2  ยท  5Comments