Open
Description
Language Server Version
0.33.1
Terraform Version
Terraform v1.8.4 on windows_amd64
Client Version
Vim (coc.nvim) 9.1
Terraform Configuration
terraform {
backend "azurerm" {
storage_account_name = "redacted"
container_name = "redacted"
key = "redacted/terraform.tfstate"
use_azuread_auth = true
}
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.106.1"
}
}
required_version = ">= 1.5"
}
provider "azurerm" {
features {}
}
locals {
location = "westus"
}
resource "azurerm_resource_group" "main" {
# Here! It complains: `No declaration found for "var.namespace" (Terraform)`
name = "${var.namespace}-tfbackend-test"
location = local.location
}
Steps to Reproduce
- Create a very simple terraform project as shown above, you can even skip the remote backend configuration.
- Create
variables.tf
and define a variablenamespace
of string type. - Run
terraform init
andterraform apply -auto-approve
- It runs successfully, but terraform-ls complains that the variable is not defined.
Expected Behavior
It should not complain because it's not a bug at all.
Actual Behavior
terraform-ls complains No declaration found for "var.namespace" (Terraform)
It shows up as an error.
Gist
No response
Workarounds
No workarounds I can find.
References
No response
Help Wanted
- I'm interested in contributing a fix myself
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment