pulumi/pkg/resource/deploy/providers/provider.go

171 lines
6.0 KiB
Go
Raw Permalink Normal View History

// Copyright 2016-2021, Pulumi Corporation.
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package providers
import (
"fmt"
"strings"
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
"github.com/blang/semver"
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
)
type ProviderParameterization struct {
// The name of the parametrized package.
name tokens.Package
// The version of the parametrized package.
version semver.Version
// The value of the parameter.
value []byte
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
}
// NewProviderParameterization constructs a new provider parameterization.
func NewProviderParameterization(name tokens.Package, version semver.Version, value []byte,
) *ProviderParameterization {
return &ProviderParameterization{
name: name,
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
version: version,
value: value,
}
}
// A ProviderRequest is a tuple of an optional semantic version, download server url, parameter, and a package name.
// Whenever the engine receives a registration for a resource that doesn't explicitly specify a provider, the engine
// creates a ProviderRequest for that resource's provider, using the version passed to the engine as part of
// RegisterResource and the package derived from the resource's token.
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
//
// The source evaluator (source_eval.go) is responsible for servicing provider requests. It does this by interpreting
// these provider requests and sending resource registrations to the engine for the providers themselves. These are
// called "default providers".
//
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
// ProviderRequest is useful as a hash key. The engine is free to instantiate any number of provider requests, but it is
// free to cache requests for a provider request that is equal to one that has already been serviced. If you do use
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
// ProviderRequest as a hash key, you should call String() to get a usable key for string-based hash maps.
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
// ProviderRequests only hash by their package name, version and download URL. The checksums and parameterization are
// not used in the hash.
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
type ProviderRequest struct {
version *semver.Version
name tokens.Package
pluginDownloadURL string
Pass provider checksums in requests and save to state (#13789) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This extends the resource monitor interface with fields for plugin checksums (on top of the existing plugin version and download url fields). These fields are threaded through the engine and are persisted in resource state. The sent or saved data is then used when installing plugins to ensure that the checksums match what was recorded at the time the SDK was built. Similar to https://github.com/pulumi/pulumi/pull/13776 nothing is using this yet, but this lays the engine side plumbing for them. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-09-11 15:54:07 +00:00
pluginChecksums map[string][]byte
parameterization *ProviderParameterization
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}
// NewProviderRequest constructs a new provider request from an optional version, optional
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
// pluginDownloadURL, optional parameter, and package.
Pass provider checksums in requests and save to state (#13789) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This extends the resource monitor interface with fields for plugin checksums (on top of the existing plugin version and download url fields). These fields are threaded through the engine and are persisted in resource state. The sent or saved data is then used when installing plugins to ensure that the checksums match what was recorded at the time the SDK was built. Similar to https://github.com/pulumi/pulumi/pull/13776 nothing is using this yet, but this lays the engine side plumbing for them. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-09-11 15:54:07 +00:00
func NewProviderRequest(
name tokens.Package, version *semver.Version,
Pass provider checksums in requests and save to state (#13789) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This extends the resource monitor interface with fields for plugin checksums (on top of the existing plugin version and download url fields). These fields are threaded through the engine and are persisted in resource state. The sent or saved data is then used when installing plugins to ensure that the checksums match what was recorded at the time the SDK was built. Similar to https://github.com/pulumi/pulumi/pull/13776 nothing is using this yet, but this lays the engine side plumbing for them. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-09-11 15:54:07 +00:00
pluginDownloadURL string, checksums map[string][]byte,
parameterization *ProviderParameterization,
Pass provider checksums in requests and save to state (#13789) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This extends the resource monitor interface with fields for plugin checksums (on top of the existing plugin version and download url fields). These fields are threaded through the engine and are persisted in resource state. The sent or saved data is then used when installing plugins to ensure that the checksums match what was recorded at the time the SDK was built. Similar to https://github.com/pulumi/pulumi/pull/13776 nothing is using this yet, but this lays the engine side plumbing for them. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-09-11 15:54:07 +00:00
) ProviderRequest {
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
return ProviderRequest{
version: version,
name: name,
pluginDownloadURL: strings.TrimSuffix(pluginDownloadURL, "/"),
Pass provider checksums in requests and save to state (#13789) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This extends the resource monitor interface with fields for plugin checksums (on top of the existing plugin version and download url fields). These fields are threaded through the engine and are persisted in resource state. The sent or saved data is then used when installing plugins to ensure that the checksums match what was recorded at the time the SDK was built. Similar to https://github.com/pulumi/pulumi/pull/13776 nothing is using this yet, but this lays the engine side plumbing for them. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-09-11 15:54:07 +00:00
pluginChecksums: checksums,
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
parameterization: parameterization,
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}
}
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
// Parameterization returns the parameterization of this provider request. May be nil if no parameterization was
// provided.
func (p ProviderRequest) Parameterization() *ProviderParameterization {
Initial work for parameterized providers (#16281) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This is the first part of paramaterized providers in the engine. This only supports "replacement" packages, that is where we fully replace a providers package with a new package (think how dynamic tfbridge will work, vs how crd2pulumi will work). I've made the decision to _not_ support using parameterised providers by sending the parameter in the RegisterResource request. This will necessitate some different work in how we send the parameter for explicit providers compared to version and pluginDownloadURL, but I think it's worth it going forward. No changelog as this is still basically unusable without codegen support done, and should still be considered primarily for internal experimental use for now. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-06-10 17:28:47 +00:00
return p.parameterization
}
// Name returns the this provider plugin name.
func (p ProviderRequest) Name() tokens.Package {
return p.name
}
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
// Version returns this provider request's version. May be nil if no version was provided.
func (p ProviderRequest) Version() *semver.Version {
return p.version
}
// Package returns this provider request's package.
func (p ProviderRequest) Package() tokens.Package {
if p.parameterization != nil {
return p.parameterization.name
}
return p.name
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}
// PluginDownloadURL returns this providers server url. May be "" if no pluginDownloadURL was
// provided.
func (p ProviderRequest) PluginDownloadURL() string {
return p.pluginDownloadURL
}
Pass provider checksums in requests and save to state (#13789) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This extends the resource monitor interface with fields for plugin checksums (on top of the existing plugin version and download url fields). These fields are threaded through the engine and are persisted in resource state. The sent or saved data is then used when installing plugins to ensure that the checksums match what was recorded at the time the SDK was built. Similar to https://github.com/pulumi/pulumi/pull/13776 nothing is using this yet, but this lays the engine side plumbing for them. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-09-11 15:54:07 +00:00
// PluginChecksums returns this providers checksums. May be nil if no checksums were provided.
func (p ProviderRequest) PluginChecksums() map[string][]byte {
return p.pluginChecksums
}
// DefaultName returns a QName that is an appropriate name for a default provider constructed from this provider
// request. The name is intended to be unique; as such, the name is derived from the version associated with this
// request.
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
//
// If a version is not provided, "default" is returned. Otherwise, Name returns a name starting with "default" and
// followed by a QName-legal representation of the semantic version of the requested provider.
func (p ProviderRequest) DefaultName() string {
base := "default"
var v *semver.Version
if p.parameterization != nil {
v = &p.parameterization.version
} else {
v = p.version
}
if v != nil {
// QNames are forbidden to contain dashes, so we construct a string here using the semantic
// version's component parts.
base += fmt.Sprintf("_%d_%d_%d", v.Major, v.Minor, v.Patch)
for _, pre := range v.Pre {
base += "_" + pre.String()
}
for _, build := range v.Build {
base += "_" + build
}
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}
if url := p.pluginDownloadURL; url != "" {
base += "_" + tokens.IntoQName(url).String()
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}
Allow anything in resource names (#14107) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> Fixes https://github.com/pulumi/pulumi/issues/13968. Fixes https://github.com/pulumi/pulumi/issues/8949. This requires changing the parsing of URN's slightly, it is _very_ likely that providers will need to update to handle URNs like this correctly. This changes resource names to be `string` not `QName`. We never validated this before and it turns out that users have put all manner of text for resource names so we just updating the system to correctly reflect that. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-20 08:59:00 +00:00
// This thing that we generated must be a QName, the engine doesn't actually care but it probably helps
// down the line if we keep these names simple.
contract.Assertf(tokens.IsQName(base), "generated provider name %q is not a QName", base)
Allow anything in resource names (#14107) <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> Fixes https://github.com/pulumi/pulumi/issues/13968. Fixes https://github.com/pulumi/pulumi/issues/8949. This requires changing the parsing of URN's slightly, it is _very_ likely that providers will need to update to handle URNs like this correctly. This changes resource names to be `string` not `QName`. We never validated this before and it turns out that users have put all manner of text for resource names so we just updating the system to correctly reflect that. ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2023-11-20 08:59:00 +00:00
return base
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}
// String returns a string representation of this request. This string is suitable for use as a hash key.
func (p ProviderRequest) String() string {
var version string
if p.parameterization != nil {
version = "-" + p.parameterization.version.String()
} else if p.version != nil {
version = "-" + p.version.String()
}
var url string
if p.pluginDownloadURL != "" {
url = "-" + p.pluginDownloadURL
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}
return p.Package().String() + version + url
Load specific provider versions if requested (#2648) * Load specific provider versions if requested As part of pulumi/pulumi#2389, we need the ability for language hosts to tell the engine that a particular resource registration, read, or invoke needs to use a particular version of a resource provider. This was not previously possible before; the engine prior to this commit loaded plugins from a default provider map, which was inferred for every resource provider based on the contents of a user's package.json, and was itself prone to bugs. This PR adds the engine support needed for language hosts to request a particular version of a provider. If this occurs, the source evaluator specifically records the intent to load a provider with a given version and produces a "default" provider registration that requests exactly that version. This allows the source evaluator to produce multiple default providers for a signle package, which was previously not possible. This is accomplished by having the source evaluator deal in the "ProviderRequest" type, which is a tuple of version and package. A request to load a provider whose version matches the package of a previously loaded provider will re-use the existing default provider. If the version was not previously loaded, a new default provider is injected. * CR Feedback: raise error if semver is invalid * CR: call String() if you want a hash key * Update pkg/resource/deploy/providers/provider.go Co-Authored-By: swgillespie <sean@pulumi.com>
2019-04-17 18:25:02 +00:00
}