Skip to content

No declaration found for "var.name" #2085

@krystofspiller

Description

@krystofspiller

Extension Version

2.34.5

VS Code Version

Version: 1.4.5 (Universal)
VSCode Version: 1.99.3
Commit: af58d92614edb1f72bdd756615d131bf8dfa5290
Date: 2025-08-13T02:08:56.371Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.6.0

Operating System

macOS Sequoia Version 15.6 (24G84)

Terraform Version

Terraform v1.12.1 on darwin_arm64

Steps to Reproduce

Minimal example:

# minimal.tf
locals {
  env_vars_secret = [
    { name = "DATABASE_URL", secret_id = module.secrets["DATABASE_URL"].secret_id },
  ]

  db_migrations_env_vars_secret = [
    for var in local.env_vars_secret :
    var.name == "DATABASE_URL" ?
    { name = "DATABASE_URL", secret_id = module.secrets["DB_MIGRATION_DATABASE_URL"].secret_id } :
    var
  ]
}

Expected Behavior

No error is shown.

Actual Behavior

Shows error for var.name and var.

Image Image

Terraform Configuration

Project Structure

Gist

No response

Anything Else?

No response

Workarounds

Renaming var to e.g. env_var fixes the issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions