Giter Club home page Giter Club logo

Comments (12)

dbanck avatar dbanck commented on June 30, 2024

Hi @phx-tim-butters, thanks for the port.

At the time of the last language server release two weeks ago, 0.6.3 was the latest provider version available. The next language server release will bundle the updated schema and fix the problem. Sorry for the inconvenience.

In the meantime, when you run terraform init, we'll use the matching provider schema from disk.

from vscode-terraform.

phx-tim-butters avatar phx-tim-butters commented on June 30, 2024

Hi @phx-tim-butters, thanks for the port.

At the time of the last language server release two weeks ago, 0.6.3 was the latest provider version available. The next language server release will bundle the updated schema and fix the problem. Sorry for the inconvenience.

In the meantime, when you run terraform init, we'll use the matching provider schema from disk.

Hi there, Thanks for your reply.

That expands my understanding of why the Language Server uses certain version. Is there no way of forcing it to utilise the latest version of a provider at all?

from vscode-terraform.

dbanck avatar dbanck commented on June 30, 2024

We bundle the latest version of all official and partner providers at build time to provide a good out-of-the-box experience. We use these schemas as a fallback, if we can't get a better matching version for your constraint.

When you run terraform init, Terraform will install your specific provider version on disk and the language server will pick that schema instead.
If you're curious, you can also find it in the log:

jobs.go:321: JOBS: Dispatching next job "6" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeObtainSchema" for {"file:///Users/dbanck/tmp/issue1701"}
provider_schema.go:109: PSS: adding local schema (/Users/dbanck/tmp/issue1701, registry.terraform.io/azure/alz): 0xc00012fa88
jobs.go:461: JOBS: Finishing job "6": "OpTypeObtainSchema" for {"file:///Users/dbanck/tmp/issue1701"} (err = %!s(<nil>), deferredJobs: [])

from vscode-terraform.

phx-tim-butters avatar phx-tim-butters commented on June 30, 2024

We bundle the latest version of all official and partner providers at build time to provide a good out-of-the-box experience. We use these schemas as a fallback, if we can't get a better matching version for your constraint.

When you run terraform init, Terraform will install your specific provider version on disk and the language server will pick that schema instead. If you're curious, you can also find it in the log:

jobs.go:321: JOBS: Dispatching next job "6" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeObtainSchema" for {"file:///Users/dbanck/tmp/issue1701"}
provider_schema.go:109: PSS: adding local schema (/Users/dbanck/tmp/issue1701, registry.terraform.io/azure/alz): 0xc00012fa88
jobs.go:461: JOBS: Finishing job "6": "OpTypeObtainSchema" for {"file:///Users/dbanck/tmp/issue1701"} (err = %!s(<nil>), deferredJobs: [])

Ahh - so, I'm doing a Terraform Init with the specific 0.8.0 version in the requried_provider section, but my Language Server is still referencing 0.6.3.

I assumed this would be the case, and would expect a Terraform Init to fix it, but it's not.

from vscode-terraform.

dbanck avatar dbanck commented on June 30, 2024

Exactly! That is how it should to work (and does for me).

Without init
CleanShot 2024-03-01 at 11 34 48@2x

After init
CleanShot 2024-03-01 at 11 34 23@2x

Can you close and reopen VS Code and then share the full log output with me?

from vscode-terraform.

phx-tim-butters avatar phx-tim-butters commented on June 30, 2024

image

I've linked both an image and output from HashiCorp Terraform.

I performed a further Terraform Init, and still the issue continued.

Output.txt

from vscode-terraform.

dbanck avatar dbanck commented on June 30, 2024

Oh, I think I know what's happening here. From the log output, it looks like you're hitting hashicorp/terraform-ls#1540

Here is what happens:

  1. The language server has parsed the configuration and is reading the required providers
  2. It loads the appropriate bundled schema (0.6.3)
  3. It runs all kinds of jobs that depend on a schema, such as validation
  4. It loads the installed schema from disk (0.8.1), which is slower than 2.
  5. It doesn't re-run the validation from 3. with the newer schema

If you change the file, like inserting a space, the validation error should go away, because the language server is now using the newer schema for everything.

from vscode-terraform.

phx-tim-butters avatar phx-tim-butters commented on June 30, 2024

Super star - thank you! That's working. Leave the issue open and link it to the bug? or close it?

from vscode-terraform.

dbanck avatar dbanck commented on June 30, 2024

Glad we figured this out! I know modifying the file isn't a good workaround, but since it only happens once right after startup, I hope it's not too bad.

I'll add this to the bug report and see if we can prioritize it in the future. I'll close it for now, but let me know if you run into any other problems.

from vscode-terraform.

dbanck avatar dbanck commented on June 30, 2024

@phx-tim-butters FYI, we just released a new version 2.29.5. This updates the schema to the latest version and should fix the validation error without having to run terraform init. The update should appear automatically in VS Code.

from vscode-terraform.

phx-tim-butters avatar phx-tim-butters commented on June 30, 2024

Oh my word, that's so much better.

It's working now - Many thanks.

from vscode-terraform.

github-actions avatar github-actions commented on June 30, 2024

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.

from vscode-terraform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.