-
Notifications
You must be signed in to change notification settings - Fork 137
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
Error when a symlink with ".tfvars" extension is created inside a workspace #957
Comments
@divergentdave Thank you for the report. This looks like a bug indeed - it looks like we don't account for symlinks. I will transfer it to the LS repository as that's where the bug will need to be fixed. |
I would have thought terraform-ls/internal/langserver/handlers/did_change_watched_files.go Lines 243 to 250 in be56006
|
@divergentdave I tried to reproduce this without much luck. The logic seems to be working as expected in that even symlinks get reflected correctly in my local environment (macOS Monterey 12.4, Apple M1 Pro, Extension Screen.Recording.2022-06-24.at.12.31.11.movFull repro steps I tried: variable "alpha" {
type = string
}
variable "beta" {
type = number
}
output "example" {
value = "${var.alpha} / ${var.beta}"
}
alpha = "foobar"
beta = 42 within the VS Code workspace
Is there any chance the notifications show a different file? If not - could you provide a repro case as a sequence of steps, and/or possibly recording? Thanks! |
Could you also provide any (custom) settings you have set for the Terraform extension? It shouldn't matter as the extension controls what files are watched internally, but it would be helpful just in case there's something different between our environments. |
As an aside - I can believe that there is possibly a bug involving symlinks, I also filed #241 some time ago and I'm aware that we don't evaluate symlinks in various places, but I still wasn't able to come up with any repro case that would demonstrate any particular bug. |
I don't have any non-default extension settings configured. I have extension version v2.23.0 installed as well. Here's a minimal reproduction, as a bash script, with a screen recording of it in action. It seems that the leading #!/bin/bash
echo 'terraform {}' > main.tf
echo 'a = 1' > vars.tfvars
mkdir dir
code .
read -s -p "Press enter to continue..." ; echo
ln -s ../vars.tfvars dir/.link.tfvars screen-recording.mp4 |
I think I found the culprit
terraform-ls/internal/terraform/ast/ast.go Lines 9 to 10 in 000cb53
|
Fix now pending review in #968 |
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. |
Versions
Extension
VS Code
Operating System
Terraform Version
Steps To Reproduce
Create a valid symlink with a filename that ends in
.tfvars
while VS Code is open, in a directory that it is watching.Expected Behavior
No error or warning.
Actual Behavior
A notification that says "Unable to update "/path/to/.current_environment.auto.tfvars": filetype not supported. This is likely a bug which should be reported."
Additional context
I have tooling in my project that creates a symlink with an
.auto.tfvars
extension, pointing to a.tfvars
file. (The Terraform CLI has worked fine with this setup) Whenever this symlink is recreated, I see a notification in VS Code with the above error.The text was updated successfully, but these errors were encountered: