Open zisom-hc opened 9 months ago
Hi @zisom-hc The mentioned attribute was added to the provider relatively recently, as you noticed.
Since we only bundle a single version of the tfe
provider schema in the language server (just like for other official+partner providers), we cannot provide the level of accuracy out of the box at this point unfortunately. The latest version available at the time of the latest LS release was v0.50.0.
The good news is however that if you run terraform init
to install the latest version of the provider (assuming you have the appropriate version constraint that matches 0.51.0
which you do), the extension will pick it up and use that schema to do the validation.
We plan to improve the experience in similar situations by eventually pulling the schema from the Registry API but this is a non-trivial project that will take some time to execute. You can follow https://github.com/hashicorp/vscode-terraform/issues/737 in the meantime.
Hey Radek, thank you for the insight regarding this. That's understandable that the provider schema currently being used within the latest version of the LS is from 0.50.0
of the tfe provider. The purpose of this was to inform y'all of the current discrepancy between the two versions at the moment.
The good news is however that if you run terraform init to install the latest version of the provider (assuming you have the appropriate version constraint that matches 0.51.0 which you do), the extension will pick it up and use that schema to do the validation.
Do i understand correctly that you're saying that the LS should be grabbing the schema for 0.51.0
when i perform a terraform init
within the working directory of my module? If that is the case, i am not seeing that behavior post-init, as in i'm still seeing the problem prompt exist, so let me know if the steps below were not correct:
terraform init
within the working directorytfe_organization
data source, which did not occurorganization.tf
in VS Code to see if the problem prompt would then go away, with no change to the result (This stepHere's a screenshot of what i'm seeing post-init:
The purpose of this was to inform y'all of the current discrepancy between the two versions at the moment.
We appreciate it, although unfortunately this impacts users of all providers and it's not a problem isolated to tfe
. Another example is in https://github.com/hashicorp/vscode-terraform/issues/1621
Do i understand correctly that you're saying that the LS should be grabbing the schema for 0.51.0 when i perform a terraform init within the working directory of my module?
That's correct - this is how it should work.
There is however one extra step you have to take today, which is to either type into the file or re-open it. We plan to do this refresh automatically in the future - I have yet to file an issue for that.
See my recordings below
typing
re-opening
Language Server Version
v0.32.4
Terraform Version
1.6.6
Client Version
VS Code 1.85.0
Terraform Configuration
Steps to Reproduce
0.51.0
of the tfe providertfe_organization
data source block without aname
argument configuredExpected Behavior
LS should recognize that in version
0.51.0
of the tfe provider, a change was made to this data source where the name argument went from being required to optional in tfe 0.51.0Actual Behavior
LS states: Required attribute "name" not specified: An attribute named "name" is required here
Gist
No response
Workarounds
You can perform a terraform plan/apply without issue, so the error is just misleading, not blocking operations from occurring.
References
No response
Help Wanted
Community Note