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

Error thrown when saving .tf or .tfvars files with names beginning with a dot #972

Closed
chriswacker opened this issue Jun 24, 2022 · 4 comments · Fixed by #971
Closed

Error thrown when saving .tf or .tfvars files with names beginning with a dot #972

chriswacker opened this issue Jun 24, 2022 · 4 comments · Fixed by #971
Assignees
Labels
bug Something isn't working
Milestone

Comments

@chriswacker
Copy link

Versions

Extension

v2.23.0

VS Code

1.68.1

Operating System

Linux a15830e0f40b 5.10.16.3-microsoft-standard-WSL2 hashicorp/vscode-terraform#1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 GNU/Linux

Terraform Version

Terraform v1.1.5
on linux_amd64

Steps To Reproduce

  1. Create a file with name: .example.tf (needs to start with a dot and be a .tf or .tfvars file)
  2. Open the file and save it
  3. See error

Expected Behavior

No error

Actual Behavior

Received error from extension:

Unable to update "/path/to/file/.example.tf": filetype not supported. This is likely a bug which should be reported.
@chriswacker chriswacker added the bug Something isn't working label Jun 24, 2022
@radeksimko
Copy link
Member

Hi @chriswacker
Thanks for the report. I believe this is a duplicate of #957 which is being fixed in #968

@radeksimko
Copy link
Member

radeksimko commented Jun 27, 2022

Actually the mentioned issue/PR handles tfvars, but I think .*.tf files still need a solution.

@chriswacker I'm curious what's your use case for *.tf files with dot at the beginning, since Terraform ignores these files?

The reason I'm asking is because it's an edge case we'll have to account for somehow. We could treat it as if it's not ignored, but that means, that e.g. if there are any errors in parsing, duplicates and any other diagnostics they'll all come up for the whole module, which doesn't reflect the reality - as invalid hidden files don't really prevent you from applying or planning.

I think what would make more sense is to apply the same logic we apply to autoloaded vs individual tfvars files. i.e. *.auto.tfvars vs foobar.tfvars where any diagnostics for foobar.tfvars are only visible when that individual file is open and *.auto.tfvars diagnostics are always visible.

@chriswacker
Copy link
Author

Hey @radeksimko, my use case is only for .*.tfvars files. In my own troubleshooting I noticed the error occurred for .*.tf files as well, and since I wasn't aware that terraform ignored those files, I thought I'd include that in this issue.

Glad a fix is on the way!

@github-actions
Copy link

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 Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants