vscode-terraform: terraform.tfvars An argument named "xxx" is not expected here.

I am having the following problem/false postive reported by the vscode-terraform extension for all variables defined in terraform.tfvars files:

An argument named "XXX" is not expected here.

image

Is there a setting I can set in settings.json to prevent the extension from checking for this in all terraform.tfvars files? Is there a way to know what rule/check of the vscode-terraform extension is triggering this?

My vscode settings for the terraform extension are as follow:

    "terraform.path": "/usr/local/bin/terraform",
    "terraform.codelens.enabled": true,
    "terraform.format": {
        "ignoreExtensionsOnSave": [
            ".tfsmurf"
        ]
    },
    "terraform.languageServer": {
        "enabled": true,
        "args": []
    },
    "terraform.indexing": {
        "enabled": false,
        "liveIndexing": false,
        "delay": 500,
        "exclude": [
            ".terraform/**/*",
            "**/.terraform/**/*"
        ]
    },
    "[terraform]": {
        "editor.formatOnSave": true,
    },
    "terraform.telemetry.enabled": false,
}

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 28
  • Comments: 24 (1 by maintainers)

Most upvoted comments

I have the same behaviour and was also not able to figure out what is causing this. Any help appreciated!

I understand this this problem is related to the language server, however would it be possible to get a work around of having the language server disabled just for files of type *.tfvars?

(admittedly I don’t have a good understanding of language servers, so maybe this question doesn’t make sense)

Disabling languageServer in sessions.json makes this error disappear.

Settings.json

"terraform.languageServer": {
        "enabled": false
}

This issue can be closed.

Any progress on this, or a way to ignore .tfvars files?