Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable with empty list causes "No declaration found" on submodules #1592

Closed
1 task
ghost opened this issue Oct 12, 2023 · 7 comments · Fixed by hashicorp/terraform-schema#289
Closed
1 task
Assignees
Labels
bug Something isn't working diagnostics

Comments

@ghost
Copy link

ghost commented Oct 12, 2023

Extension Version

2.28.1

VS Code Version

Version: 1.83.0 (Universal)
Commit: e7e037083ff4455cf320e344325dacb480062c3c
Date: 2023-10-03T16:13:15.449Z (1 wk ago)
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0

Operating System

macOS Ventura 13.6 (22G120)

Terraform Version

Terraform v1.6.1 on darwin_arm64

Steps to Reproduce

Having the following structure: (included in the zip)

.
├── main.tf
└── modules
    ├── submodule-a
    │   ├── main.tf
    │   └── variables.tf
    └── submodule-b
        └── variables.tf

no-declaration-found.zip

Expected Behavior

No error, as on version 2.27.2, or to be consistent with terraform validate

Actual Behavior

terraform validate shows no issues, VSCode with extension 2.28.1 shows "No declaration found" on modules/submodule-a/main.tf line 4

Terraform Configuration

No response

Project Structure

.
├── main.tf
└── modules
    ├── submodule-a
    │   ├── main.tf
    │   └── variables.tf
    └── submodule-b
        └── variables.tf

Gist

No response

Anything Else?

No response

Workarounds

Define the type explicitly on all variable files as type = list(string)

References

#1576

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
@ghost ghost added the bug Something isn't working label Oct 12, 2023
@CapricornVortex
Copy link

I also saw this yesterday - Same issue as above, I set the type as type = list(any) but I still had the error - popped a value in for the default empty list and saved :
default = ["value"]
and then removed it and resaved - the "No declaration found" error has now gone even though the code is now the same

@ghost
Copy link
Author

ghost commented Oct 13, 2023

@CapricornVortex, also seen this. For me it often has some delay between save & showing up the error again (or the other way round).
The most reliable way to validate if the error is gone, was to change the plugin version (2.27.2 <> 2.28.1) & reload

@mario-nc

This comment was marked as off-topic.

@radeksimko
Copy link
Member

@FeltlP I was able to reproduce this but haven't had the chance to debug it yet. Thanks for the report and for attaching the ZIP file, that's helpful.

@mskrishna2808

This comment was marked as off-topic.

@dbanck
Copy link
Member

dbanck commented Nov 8, 2023

We just released a new version 2.29.0. This fixes the reported bug. The update should appear automatically in VS Code.

Thank you for the report @FeltlP


In case you experience any different validation related bug, please do let us know through a new issue.

Copy link

github-actions bot commented Dec 9, 2023

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 details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working diagnostics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants