hashicorp / vscode-terraform

HashiCorp Terraform VSCode extension
https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform
Mozilla Public License 2.0
927 stars 179 forks source link

Mutliple errors/warnings showing for Azure resources that are perfectly valid for provider v3 #1871

Open scott-doyland-burrows opened 2 weeks ago

scott-doyland-burrows commented 2 weeks ago

Extension Version

v2.33.0

VS Code Version

Version: 1.94.0 (user setup) Commit: d78a74bcdfad14d5d3b1b782f87255d802b57511 Date: 2024-10-02T13:08:12.626Z Electron: 30.5.1 ElectronBuildId: 10262041 Chromium: 124.0.6367.243 Node.js: 20.16.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.19045

Operating System

Window using WSL

Terraform Version

Terraform v1.9.8 on linux_amd64

Steps to Reproduce

I am using the azurerm provider and it is set as version 3.66.0 in the provider.tf file.

The extension is reporting that some of my valid terraform code is now invalid. I assume it is basing this on the fact that resources using provider v4 have different options, ie v4 is the new/latest provider.

Expected Behavior

Should the extension recognize I am using provider v3 and use that to determine if my code is correct.

Actual Behavior

image

image

Terraform Configuration

No response

Project Structure

No response

Gist

No response

Anything Else?

No response

Workarounds

No response

References

No response

Help Wanted

Community Note

dbanck commented 1 day ago

Hi @scott-doyland-burrows,

Thanks for the report! By default the language server ships with the latest available provider schema, but if you have a local installation of the provider, this version will be preferred.

After running terraform init, I see that the correct version is being used. CleanShot 2024-11-14 at 14 58 35@2x

If you see different behaviour in your project, it may be a bug. Does running terraform init solve the problem for you?

In case you want to learn more about how we handle provider schemes, we have an explainer here: https://github.com/hashicorp/terraform-ls/blob/main/docs/schema.md