hashicorp / vscode-terraform

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

Schema download not working #1828

Open stevehipwell opened 2 months ago

stevehipwell commented 2 months ago

Extension Version

v2.32.2

VS Code Version

Version: 1.92.2 (system setup) Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9 Date: 2024-08-14T17:29:30.058Z Electron: 30.1.2 ElectronBuildId: 9870757 Chromium: 124.0.6367.243 Node.js: 20.14.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631

Operating System

Windows 11 Enterprise 23H2 OS build 22631.4037

Terraform Version

Terraform v1.9.5 on windows_amd64

Steps to Reproduce

  1. Use an argument on a resource that was added since the extension was packaged
  2. See error below

image

Expected Behavior

I expect that the extension is able to use a later schema than it's built with.

Actual Behavior

Only the schemas that were built with the extension are used.

Terraform Configuration

resource "aws_eks_cluster" "test" {
  name     = var.name
  role_arn = aws_iam_role.default.arn
  vpc_config {
    subnet_ids = var.subnet_ids
  }

  upgrade_policy {
    support_type = "STANDARD"
  }
}

Project Structure

No response

Gist

No response

Anything Else?

No response

Workarounds

No response

References

No response

Help Wanted

Community Note

ppo-38 commented 2 months ago

Ideally, the extension should even support the version of the provider used in the project.

In my project, I'm using an old version of the hashicorp/aws provider (4.67.0) and the extension tells me that a resource attribute is deprecated in my project because it's based on the schema of the 5.60.0 version and not the 4.67.0.

Attribute aws_cloudwatch_event_rule.is_enabled is deprecated since 5.27.0 and I would like to avoid warnings as long as I have defined a provider version < 5.27.0 in my project.

Perhaps that the extension could load the needed provider version in .terraform.lock.hcl file ?