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

It doesn't follow symlinks #1658

Open
1 task
notorand-it opened this issue Dec 28, 2023 · 2 comments
Open
1 task

It doesn't follow symlinks #1658

notorand-it opened this issue Dec 28, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@notorand-it
Copy link

Extension Version

v2.29.1

VS Code Version

Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:47:11.635Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.6.8-zen1-1-zen

Operating System

ArchLinux (up to date)

Terraform Version

Terraform v1.6.6 on linux_amd64

Steps to Reproduce

  1. Create a local in a different directory with something like this: locals { test = "test" }
  2. In the current directory create some code that refers to local.test as a string.
  3. Create a symlink of the file from step no.1 into the directory of step no.2
  4. Fire vscode: code -n . into the directory of step no.2

Expected Behavior

No syntax error is shown about local.test

Actual Behavior

A syntax error about "missing definition of local.test " is shown until a do a manual "terraform validate" .
After that the syntax error is gone for good. :/

Terraform Configuration

No response

Project Structure

No response

Gist

No response

Anything Else?

No response

Workarounds

No response

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
@notorand-it notorand-it added the bug Something isn't working label Dec 28, 2023
@dmitry-mightydevops
Copy link

dmitry-mightydevops commented Dec 28, 2023

I have similar issue with invalid tfvars files. After update all my .tfvars variables (absolutely all) are invalid with the message
image

in the console validation works no issues

➜ ls -la
total 144K
drwxr-xr-x. 1 dmitry dmitry 822 Dec 26 17:58 .
drwxr-xr-x. 1 dmitry dmitry 148 Nov 22 13:23 ..
drwxr-xr-x. 1 dmitry dmitry  88 Nov 26 15:36 .terraform
-rw-r--r--. 1 dmitry dmitry 13K Dec 22 20:24 .terraform.lock.hcl
lrwxrwxrwx. 1 dmitry dmitry  29 Oct 16 05:59 addons.tf -> ../../../stacks/eks/addons.tf
lrwxrwxrwx. 1 dmitry dmitry  29 Oct 16 05:59 backup.tf -> ../../../stacks/eks/backup.tf
-rw-r--r--. 1 dmitry dmitry 410 Oct 16 05:59 cloud.tf
lrwxrwxrwx. 1 dmitry dmitry  29 Oct 16 06:05 config.tf -> ../../../stacks/eks/config.tf
lrwxrwxrwx. 1 dmitry dmitry  27 Oct 16 05:59 data.tf -> ../../../stacks/eks/data.tf
lrwxrwxrwx. 1 dmitry dmitry  33 Oct 16 05:59 encryption.tf -> ../../../stacks/eks/encryption.tf
lrwxrwxrwx. 1 dmitry dmitry  34 Nov 21 12:09 irsa-argocd.tf -> ../../../stacks/eks/irsa-argocd.tf
lrwxrwxrwx. 1 dmitry dmitry  40 Oct 16 05:59 irsa-cert-manager.tf -> ../../../stacks/eks/irsa-cert-manager.tf
lrwxrwxrwx. 1 dmitry dmitry  40 Oct 16 05:59 irsa-external-dns.tf -> ../../../stacks/eks/irsa-external-dns.tf
lrwxrwxrwx. 1 dmitry dmitry  44 Oct 16 05:59 irsa-external-secrets.tf -> ../../../stacks/eks/irsa-external-secrets.tf
lrwxrwxrwx. 1 dmitry dmitry  35 Nov 20 16:32 irsa-grafana.tf -> ../../../stacks/eks/irsa-grafana.tf
lrwxrwxrwx. 1 dmitry dmitry  32 Nov  3 13:41 irsa-loki.tf -> ../../../stacks/eks/irsa-loki.tf
lrwxrwxrwx. 1 dmitry dmitry  34 Dec 22 16:00 irsa-tekton.tf -> ../../../stacks/eks/irsa-tekton.tf
lrwxrwxrwx. 1 dmitry dmitry  42 Oct 16 05:59 irsa-teleport-agent.tf -> ../../../stacks/eks/irsa-teleport-agent.tf
lrwxrwxrwx. 1 dmitry dmitry  36 Oct 16 05:59 irsa-teleport.tf -> ../../../stacks/eks/irsa-teleport.tf
lrwxrwxrwx. 1 dmitry dmitry  33 Nov 17 19:32 irsa-tempo.tf -> ../../../stacks/eks/irsa-tempo.tf
lrwxrwxrwx. 1 dmitry dmitry  34 Oct 16 05:59 irsa-velero.tf -> ../../../stacks/eks/irsa-velero.tf
lrwxrwxrwx. 1 dmitry dmitry  29 Oct 16 05:59 locals.tf -> ../../../stacks/eks/locals.tf
lrwxrwxrwx. 1 dmitry dmitry  27 Oct 16 05:59 main.tf -> ../../../stacks/eks/main.tf
lrwxrwxrwx. 1 dmitry dmitry  34 Oct 16 05:59 node-groups.tf -> ../../../stacks/eks/node-groups.tf
lrwxrwxrwx. 1 dmitry dmitry  30 Oct 16 05:59 outputs.tf -> ../../../stacks/eks/outputs.tf
lrwxrwxrwx. 1 dmitry dmitry  31 Oct 16 05:59 policies.tf -> ../../../stacks/eks/policies.tf
-rw-r--r--. 1 dmitry dmitry 19K Dec 28 14:10 prod.tfvars
lrwxrwxrwx. 1 dmitry dmitry  38 Oct 16 05:59 security-groups.tf -> ../../../stacks/eks/security-groups.tf
lrwxrwxrwx. 1 dmitry dmitry  28 Oct 16 05:59 teams.tf -> ../../../stacks/eks/teams.tf
lrwxrwxrwx. 1 dmitry dmitry  46 Oct 25 01:49 teleport-roles-policies.tf -> ../../../stacks/eks/teleport-roles-policies.tf
lrwxrwxrwx. 1 dmitry dmitry  37 Oct 24 04:21 teleport-roles.tf -> ../../../stacks/eks/teleport-roles.tf
lrwxrwxrwx. 1 dmitry dmitry  32 Oct 16 05:59 variables.tf -> ../../../stacks/eks/variables.tf

➜ terraform validate
Success! The configuration is valid.

some output from the extension:

2023/12/28 14:23:15 opts.go:215: Posting server notification "textDocument/publishDiagnostics" {"uri":"file:///home/dmitry/Projects/project/project-infra-aws/environments/prod/ecr/prod.tfvars","diagnostics":[{"range":{"start":{"line":22,"character":0},"end":{"line":22,"character":14}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"component\" is not expected here"},{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":20}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"environment\" is not expected here"},{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":26}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"created_at\" is not expected here"},{"range":{"start":{"line":5,"character":0},"end":{"line":5,"character":40}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"replicate_aws_region\" is not expected here"},{"range":{"start":{"line":8,"character":0},"end":{"line":12,"character":1}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"ecr_repositories\" is not expected here"},{"range":{"start":{"line":19,"character":0},"end":{"line":19,"character":22}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"team\" is not expected here"},{"range":{"start":{"line":21,"character":0},"end":{"line":21,"character":21}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"project\" is not expected here"},{"range":{"start":{"line":1,"character":0},"end":{"line":1,"character":29}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"created_by\" is not expected here"},{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":40}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"primary_aws_region\" is not expected here"},{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":33}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"replicate_ecr_repositories\" is not expected here"},{"range":{"start":{"line":14,"character":0},"end":{"line":17,"character":1}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"ecr_repositories_access\" is not expected here"},{"range":{"start":{"line":20,"character":0},"end":{"line":20,"character":21}},"severity":1,"source":"Terraform","message":"Unexpected attribute: An attribute named \"client\" is not expected here"}]}
2023/12/28 14:23:15 opts.go:215: Dequeued request batch of length 1 (qlen=0)
2023/12/28 14:23:15 rpc_logger.go:32: Incoming request for "textDocument/documentLink" (ID 73): {"textDocument":{"uri":"file:///home/dmitry/Projects/project/project-infra-aws/environments/prod/ecr/prod.tfvars"}}
...
2023/12/28 14:23:17 provider_schema.go:306: PSS: getting provider schema (/home/dmitry/Projects/project/project-infra-aws/environments/prod/eks, registry.terraform.io/hashicorp/kubernetes, 2.24.0)
2023/12/28 14:23:17 provider_schema.go:306: PSS: getting provider schema (/home/dmitry/Projects/project/project-infra-aws/environments/prod/eks, registry.terraform.io/hashicorp/random, 3.6.0)
2023/12/28 14:23:17 hover.go:35: Looking for hover data at "prod.tfvars" -> hcl.Pos{Line:43, Column:58, Byte:2286}
2023/12/28 14:23:17 hover.go:37: received hover data: (*lang.HoverData)(nil)
2023/12/28 14:23:17 rpc_logger.go:48: Error for "textDocument/hover" (ID 78): [-32098] prod.tfvars (43,58): position outside of any attribute name, value or block
2023/12/28 14:23:17 opts.go:215: Completed 1 requests [25.342207ms elapsed]
[Error - 14:23:17] Request textDocument/hover failed.
  Message: prod.tfvars (43,58): position outside of any attribute name, value or block

@radeksimko
Copy link
Member

It is true we don't currently support symlinks. We already track this under hashicorp/terraform-ls#1398 and hashicorp/terraform-ls#1409.

This report is however still appreciated as it brings another angle to show why it's important to address it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants