Don't try to install provider during schema loading unless missing #13305
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes pulumi/pulumi-terraform-bridge#1247
When running tfgen the provider plugin is generally only available on PATH, not in the plugins directory. The schema loader was only checking the plugins directory to decided if it had a resource provider already installed, and so sent off lots of github requests to lookup latest versions of plugins while running example conversion.
This changes the schema loader to use the same logic we use elsewhere where we try to use the provider (which will also look at PATH) and then if we get a missing plugin error we'll do the install and then try again.
I've also moved the
SetKnownPluginDownloadURL
call into workspace.InstallPlugin so we don't forget to call it before passing specs in.Finally I've also removed the InstallPlugin method from Host as the only place it was used was in the schema loader, which is now using workspace.InstallPlugin like everywhere else.
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change