-
Notifications
You must be signed in to change notification settings - Fork 179
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
config
attribute not expected in terraform_remote_state
data source
#1606
Comments
I was able to reproduce the bug, thank you for attaching the configuration @pawwe It indeed looks like that we don't account for the possibility of |
Notes for whoever gets to work on the fix: I think we may need to update the logic in https://github.com/hashicorp/hcl-lang/blob/cc41e378f3a4c832a8e8e1fdde1c3705ee66e20c/decoder/internal/schemahelper/block_schema.go#L95-L98 to ensure that in this context dependent body lookup is treated as unsuccessful (unless it is already?) and that should in turn make sure that the validator receives the appropriate context, as per https://github.com/hashicorp/hcl-lang/blob/cc41e378f3a4c832a8e8e1fdde1c3705ee66e20c/decoder/internal/walker/walker.go#L91-L94 and unknown attributes won't be flagged up. On a separate note we could create a follow-up issue to enable validation in such a dynamic context but I expect that will be a bit more involved. |
This was addressed in hashicorp/hcl-lang#339 and will be part of the next release. |
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. |
Extension Version
v2.28.2
VS Code Version
Version: 1.83.1
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:45:31.402Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.5.7-200.fc38.x86_64
Operating System
Linux fws 6.5.7-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 11 04:07:58 UTC 2023 x86_64 GNU/Linux
Terraform Version
Terraform v1.6.2 on linux_amd64
Steps to Reproduce
Create a
terraform_remote_state
data source with aconfig
argument where thebackend
argument is a variable.Expected Behavior
Should not throw "Unexpected attribute" error.
Actual Behavior
Unexpected attribute: An attribute named "config" is not expected here
Terraform Configuration
Project Structure
No response
Gist
No response
Anything Else?
No response
Workarounds
Downgrading to v2.27.2 or "hard coding" the
backend
attribute to"azurerm"
resolves this problem.References
terraform_remote_state
config
incorrectly flagged with errors #1580Help Wanted
Community Note
The text was updated successfully, but these errors were encountered: