Implement first-class providers. (#1695)
### First-Class Providers
These changes implement support for first-class providers. First-class
providers are provider plugins that are exposed as resources via the
Pulumi programming model so that they may be explicitly and multiply
instantiated. Each instance of a provider resource may be configured
differently, and configuration parameters may be source from the
outputs of other resources.
### Provider Plugin Changes
In order to accommodate the need to verify and diff provider
configuration and configure providers without complete configuration
information, these changes adjust the high-level provider plugin
interface. Two new methods for validating a provider's configuration
and diffing changes to the same have been added (`CheckConfig` and
`DiffConfig`, respectively), and the type of the configuration bag
accepted by `Configure` has been changed to a `PropertyMap`.
These changes have not yet been reflected in the provider plugin gRPC
interface. We will do this in a set of follow-up changes. Until then,
these methods are implemented by adapters:
- `CheckConfig` validates that all configuration parameters are string
or unknown properties. This is necessary because existing plugins
only accept string-typed configuration values.
- `DiffConfig` either returns "never replace" if all configuration
values are known or "must replace" if any configuration value is
unknown. The justification for this behavior is given
[here](https://github.com/pulumi/pulumi/pull/1695/files#diff-a6cd5c7f337665f5bb22e92ca5f07537R106)
- `Configure` converts the config bag to a legacy config map and
configures the provider plugin if all config values are known. If any
config value is unknown, the underlying plugin is not configured and
the provider may only perform `Check`, `Read`, and `Invoke`, all of
which return empty results. We justify this behavior becuase it is
only possible during a preview and provides the best experience we
can manage with the existing gRPC interface.
### Resource Model Changes
Providers are now exposed as resources that participate in a stack's
dependency graph. Like other resources, they are explicitly created,
may have multiple instances, and may have dependencies on other
resources. Providers are referred to using provider references, which
are a combination of the provider's URN and its ID. This design
addresses the need during a preview to refer to providers that have not
yet been physically created and therefore have no ID.
All custom resources that are not themselves providers must specify a
single provider via a provider reference. The named provider will be
used to manage that resource's CRUD operations. If a resource's
provider reference changes, the resource must be replaced. Though its
URN is not present in the resource's dependency list, the provider
should be treated as a dependency of the resource when topologically
sorting the dependency graph.
Finally, `Invoke` operations must now specify a provider to use for the
invocation via a provider reference.
### Engine Changes
First-class providers support requires a few changes to the engine:
- The engine must have some way to map from provider references to
provider plugins. It must be possible to add providers from a stack's
checkpoint to this map and to register new/updated providers during
the execution of a plan in response to CRUD operations on provider
resources.
- In order to support updating existing stacks using existing Pulumi
programs that may not explicitly instantiate providers, the engine
must be able to manage the "default" providers for each package
referenced by a checkpoint or Pulumi program. The configuration for
a "default" provider is taken from the stack's configuration data.
The former need is addressed by adding a provider registry type that is
responsible for managing all of the plugins required by a plan. In
addition to loading plugins froma checkpoint and providing the ability
to map from a provider reference to a provider plugin, this type serves
as the provider plugin for providers themselves (i.e. it is the
"provider provider").
The latter need is solved via two relatively self-contained changes to
plan setup and the eval source.
During plan setup, the old checkpoint is scanned for custom resources
that do not have a provider reference in order to compute the set of
packages that require a default provider. Once this set has been
computed, the required default provider definitions are conjured and
prepended to the checkpoint's resource list. Each resource that
requires a default provider is then updated to refer to the default
provider for its package.
While an eval source is running, each custom resource registration,
resource read, and invoke that does not name a provider is trapped
before being returned by the source iterator. If no default provider
for the appropriate package has been registered, the eval source
synthesizes an appropriate registration, waits for it to complete, and
records the registered provider's reference. This reference is injected
into the original request, which is then processed as usual. If a
default provider was already registered, the recorded reference is
used and no new registration occurs.
### SDK Changes
These changes only expose first-class providers from the Node.JS SDK.
- A new abstract class, `ProviderResource`, can be subclassed and used
to instantiate first-class providers.
- A new field in `ResourceOptions`, `provider`, can be used to supply
a particular provider instance to manage a `CustomResource`'s CRUD
operations.
- A new type, `InvokeOptions`, can be used to specify options that
control the behavior of a call to `pulumi.runtime.invoke`. This type
includes a `provider` field that is analogous to
`ResourceOptions.provider`.
2018-08-07 00:50:29 +00:00
|
|
|
// Copyright 2016-2018, Pulumi Corporation.
|
|
|
|
//
|
|
|
|
// 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"
|
|
|
|
"sync"
|
|
|
|
|
|
|
|
"github.com/blang/semver"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
uuid "github.com/satori/go.uuid"
|
|
|
|
|
|
|
|
"github.com/pulumi/pulumi/pkg/resource"
|
|
|
|
"github.com/pulumi/pulumi/pkg/resource/plugin"
|
|
|
|
"github.com/pulumi/pulumi/pkg/tokens"
|
|
|
|
"github.com/pulumi/pulumi/pkg/util/contract"
|
|
|
|
"github.com/pulumi/pulumi/pkg/util/logging"
|
|
|
|
"github.com/pulumi/pulumi/pkg/workspace"
|
|
|
|
)
|
|
|
|
|
|
|
|
// getProviderVersion fetches and parses a provider version from the given property map. If the version property is not
|
|
|
|
// present, this function returns nil.
|
|
|
|
func getProviderVersion(inputs resource.PropertyMap) (*semver.Version, error) {
|
|
|
|
versionProp, ok := inputs["version"]
|
|
|
|
if !ok {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if !versionProp.IsString() {
|
|
|
|
return nil, errors.New("'version' must be a string")
|
|
|
|
}
|
|
|
|
|
|
|
|
sv, err := semver.ParseTolerant(versionProp.StringValue())
|
|
|
|
if err != nil {
|
|
|
|
return nil, errors.Errorf("could not parse provider version: %v", err)
|
|
|
|
}
|
|
|
|
return &sv, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Registry manages the lifecylce of provider resources and their plugins and handles the resolution of provider
|
|
|
|
// references to loaded plugins.
|
|
|
|
//
|
|
|
|
// When a registry is created, it is handed the set of old provider resources that it will manage. Each provider
|
|
|
|
// resource in this set is loaded and configured as per its recorded inputs and registered under the provider
|
|
|
|
// reference that corresponds to its URN and ID, both of which must be known. At this point, the created registry is
|
|
|
|
// prepared to be used to manage the lifecycle of these providers as well as any new provider resources requested by
|
|
|
|
// invoking the registry's CRUD operations.
|
|
|
|
//
|
|
|
|
// In order to fit neatly in to the existing infrastructure for managing resources using Pulumi, a provider regidstry
|
|
|
|
// itself implements the plugin.Provider interface.
|
|
|
|
type Registry struct {
|
|
|
|
host plugin.Host
|
|
|
|
isPreview bool
|
|
|
|
providers map[Reference]plugin.Provider
|
|
|
|
m sync.RWMutex
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ plugin.Provider = (*Registry)(nil)
|
|
|
|
|
|
|
|
// NewRegistry creates a new provider registry using the given host and old resources. Each provider present in the old
|
|
|
|
// resources will be loaded, configured, and added to the returned registry under its reference. If any provider is not
|
|
|
|
// loadable/configurable or has an invalid ID, this function returns an error.
|
|
|
|
func NewRegistry(host plugin.Host, prev []*resource.State, isPreview bool) (*Registry, error) {
|
|
|
|
r := &Registry{
|
|
|
|
host: host,
|
|
|
|
isPreview: isPreview,
|
|
|
|
providers: make(map[Reference]plugin.Provider),
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, res := range prev {
|
|
|
|
urn := res.URN
|
|
|
|
if !IsProviderType(urn.Type()) {
|
|
|
|
logging.V(7).Infof("provider(%v): %v", urn, res.Provider)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure that this provider has a known ID.
|
|
|
|
if res.ID == "" || res.ID == UnknownID {
|
|
|
|
return nil, errors.Errorf("provider '%v' has an unknown ID", urn)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure that we have no duplicates.
|
|
|
|
ref := mustNewReference(urn, res.ID)
|
|
|
|
if _, ok := r.providers[ref]; ok {
|
|
|
|
return nil, errors.Errorf("duplicate provider found in old state: '%v'", ref)
|
|
|
|
}
|
|
|
|
|
2018-10-20 00:22:50 +00:00
|
|
|
providerPkg := getProviderPackage(urn.Type())
|
|
|
|
|
Implement first-class providers. (#1695)
### First-Class Providers
These changes implement support for first-class providers. First-class
providers are provider plugins that are exposed as resources via the
Pulumi programming model so that they may be explicitly and multiply
instantiated. Each instance of a provider resource may be configured
differently, and configuration parameters may be source from the
outputs of other resources.
### Provider Plugin Changes
In order to accommodate the need to verify and diff provider
configuration and configure providers without complete configuration
information, these changes adjust the high-level provider plugin
interface. Two new methods for validating a provider's configuration
and diffing changes to the same have been added (`CheckConfig` and
`DiffConfig`, respectively), and the type of the configuration bag
accepted by `Configure` has been changed to a `PropertyMap`.
These changes have not yet been reflected in the provider plugin gRPC
interface. We will do this in a set of follow-up changes. Until then,
these methods are implemented by adapters:
- `CheckConfig` validates that all configuration parameters are string
or unknown properties. This is necessary because existing plugins
only accept string-typed configuration values.
- `DiffConfig` either returns "never replace" if all configuration
values are known or "must replace" if any configuration value is
unknown. The justification for this behavior is given
[here](https://github.com/pulumi/pulumi/pull/1695/files#diff-a6cd5c7f337665f5bb22e92ca5f07537R106)
- `Configure` converts the config bag to a legacy config map and
configures the provider plugin if all config values are known. If any
config value is unknown, the underlying plugin is not configured and
the provider may only perform `Check`, `Read`, and `Invoke`, all of
which return empty results. We justify this behavior becuase it is
only possible during a preview and provides the best experience we
can manage with the existing gRPC interface.
### Resource Model Changes
Providers are now exposed as resources that participate in a stack's
dependency graph. Like other resources, they are explicitly created,
may have multiple instances, and may have dependencies on other
resources. Providers are referred to using provider references, which
are a combination of the provider's URN and its ID. This design
addresses the need during a preview to refer to providers that have not
yet been physically created and therefore have no ID.
All custom resources that are not themselves providers must specify a
single provider via a provider reference. The named provider will be
used to manage that resource's CRUD operations. If a resource's
provider reference changes, the resource must be replaced. Though its
URN is not present in the resource's dependency list, the provider
should be treated as a dependency of the resource when topologically
sorting the dependency graph.
Finally, `Invoke` operations must now specify a provider to use for the
invocation via a provider reference.
### Engine Changes
First-class providers support requires a few changes to the engine:
- The engine must have some way to map from provider references to
provider plugins. It must be possible to add providers from a stack's
checkpoint to this map and to register new/updated providers during
the execution of a plan in response to CRUD operations on provider
resources.
- In order to support updating existing stacks using existing Pulumi
programs that may not explicitly instantiate providers, the engine
must be able to manage the "default" providers for each package
referenced by a checkpoint or Pulumi program. The configuration for
a "default" provider is taken from the stack's configuration data.
The former need is addressed by adding a provider registry type that is
responsible for managing all of the plugins required by a plan. In
addition to loading plugins froma checkpoint and providing the ability
to map from a provider reference to a provider plugin, this type serves
as the provider plugin for providers themselves (i.e. it is the
"provider provider").
The latter need is solved via two relatively self-contained changes to
plan setup and the eval source.
During plan setup, the old checkpoint is scanned for custom resources
that do not have a provider reference in order to compute the set of
packages that require a default provider. Once this set has been
computed, the required default provider definitions are conjured and
prepended to the checkpoint's resource list. Each resource that
requires a default provider is then updated to refer to the default
provider for its package.
While an eval source is running, each custom resource registration,
resource read, and invoke that does not name a provider is trapped
before being returned by the source iterator. If no default provider
for the appropriate package has been registered, the eval source
synthesizes an appropriate registration, waits for it to complete, and
records the registered provider's reference. This reference is injected
into the original request, which is then processed as usual. If a
default provider was already registered, the recorded reference is
used and no new registration occurs.
### SDK Changes
These changes only expose first-class providers from the Node.JS SDK.
- A new abstract class, `ProviderResource`, can be subclassed and used
to instantiate first-class providers.
- A new field in `ResourceOptions`, `provider`, can be used to supply
a particular provider instance to manage a `CustomResource`'s CRUD
operations.
- A new type, `InvokeOptions`, can be used to specify options that
control the behavior of a call to `pulumi.runtime.invoke`. This type
includes a `provider` field that is analogous to
`ResourceOptions.provider`.
2018-08-07 00:50:29 +00:00
|
|
|
// Parse the provider version, then load, configure, and register the provider.
|
|
|
|
version, err := getProviderVersion(res.Inputs)
|
|
|
|
if err != nil {
|
2018-10-20 00:22:50 +00:00
|
|
|
return nil, errors.Errorf("could not parse version for %v provider '%v': %v", providerPkg, urn, err)
|
Implement first-class providers. (#1695)
### First-Class Providers
These changes implement support for first-class providers. First-class
providers are provider plugins that are exposed as resources via the
Pulumi programming model so that they may be explicitly and multiply
instantiated. Each instance of a provider resource may be configured
differently, and configuration parameters may be source from the
outputs of other resources.
### Provider Plugin Changes
In order to accommodate the need to verify and diff provider
configuration and configure providers without complete configuration
information, these changes adjust the high-level provider plugin
interface. Two new methods for validating a provider's configuration
and diffing changes to the same have been added (`CheckConfig` and
`DiffConfig`, respectively), and the type of the configuration bag
accepted by `Configure` has been changed to a `PropertyMap`.
These changes have not yet been reflected in the provider plugin gRPC
interface. We will do this in a set of follow-up changes. Until then,
these methods are implemented by adapters:
- `CheckConfig` validates that all configuration parameters are string
or unknown properties. This is necessary because existing plugins
only accept string-typed configuration values.
- `DiffConfig` either returns "never replace" if all configuration
values are known or "must replace" if any configuration value is
unknown. The justification for this behavior is given
[here](https://github.com/pulumi/pulumi/pull/1695/files#diff-a6cd5c7f337665f5bb22e92ca5f07537R106)
- `Configure` converts the config bag to a legacy config map and
configures the provider plugin if all config values are known. If any
config value is unknown, the underlying plugin is not configured and
the provider may only perform `Check`, `Read`, and `Invoke`, all of
which return empty results. We justify this behavior becuase it is
only possible during a preview and provides the best experience we
can manage with the existing gRPC interface.
### Resource Model Changes
Providers are now exposed as resources that participate in a stack's
dependency graph. Like other resources, they are explicitly created,
may have multiple instances, and may have dependencies on other
resources. Providers are referred to using provider references, which
are a combination of the provider's URN and its ID. This design
addresses the need during a preview to refer to providers that have not
yet been physically created and therefore have no ID.
All custom resources that are not themselves providers must specify a
single provider via a provider reference. The named provider will be
used to manage that resource's CRUD operations. If a resource's
provider reference changes, the resource must be replaced. Though its
URN is not present in the resource's dependency list, the provider
should be treated as a dependency of the resource when topologically
sorting the dependency graph.
Finally, `Invoke` operations must now specify a provider to use for the
invocation via a provider reference.
### Engine Changes
First-class providers support requires a few changes to the engine:
- The engine must have some way to map from provider references to
provider plugins. It must be possible to add providers from a stack's
checkpoint to this map and to register new/updated providers during
the execution of a plan in response to CRUD operations on provider
resources.
- In order to support updating existing stacks using existing Pulumi
programs that may not explicitly instantiate providers, the engine
must be able to manage the "default" providers for each package
referenced by a checkpoint or Pulumi program. The configuration for
a "default" provider is taken from the stack's configuration data.
The former need is addressed by adding a provider registry type that is
responsible for managing all of the plugins required by a plan. In
addition to loading plugins froma checkpoint and providing the ability
to map from a provider reference to a provider plugin, this type serves
as the provider plugin for providers themselves (i.e. it is the
"provider provider").
The latter need is solved via two relatively self-contained changes to
plan setup and the eval source.
During plan setup, the old checkpoint is scanned for custom resources
that do not have a provider reference in order to compute the set of
packages that require a default provider. Once this set has been
computed, the required default provider definitions are conjured and
prepended to the checkpoint's resource list. Each resource that
requires a default provider is then updated to refer to the default
provider for its package.
While an eval source is running, each custom resource registration,
resource read, and invoke that does not name a provider is trapped
before being returned by the source iterator. If no default provider
for the appropriate package has been registered, the eval source
synthesizes an appropriate registration, waits for it to complete, and
records the registered provider's reference. This reference is injected
into the original request, which is then processed as usual. If a
default provider was already registered, the recorded reference is
used and no new registration occurs.
### SDK Changes
These changes only expose first-class providers from the Node.JS SDK.
- A new abstract class, `ProviderResource`, can be subclassed and used
to instantiate first-class providers.
- A new field in `ResourceOptions`, `provider`, can be used to supply
a particular provider instance to manage a `CustomResource`'s CRUD
operations.
- A new type, `InvokeOptions`, can be used to specify options that
control the behavior of a call to `pulumi.runtime.invoke`. This type
includes a `provider` field that is analogous to
`ResourceOptions.provider`.
2018-08-07 00:50:29 +00:00
|
|
|
}
|
2018-10-20 00:22:50 +00:00
|
|
|
provider, err := host.Provider(providerPkg, version)
|
Implement first-class providers. (#1695)
### First-Class Providers
These changes implement support for first-class providers. First-class
providers are provider plugins that are exposed as resources via the
Pulumi programming model so that they may be explicitly and multiply
instantiated. Each instance of a provider resource may be configured
differently, and configuration parameters may be source from the
outputs of other resources.
### Provider Plugin Changes
In order to accommodate the need to verify and diff provider
configuration and configure providers without complete configuration
information, these changes adjust the high-level provider plugin
interface. Two new methods for validating a provider's configuration
and diffing changes to the same have been added (`CheckConfig` and
`DiffConfig`, respectively), and the type of the configuration bag
accepted by `Configure` has been changed to a `PropertyMap`.
These changes have not yet been reflected in the provider plugin gRPC
interface. We will do this in a set of follow-up changes. Until then,
these methods are implemented by adapters:
- `CheckConfig` validates that all configuration parameters are string
or unknown properties. This is necessary because existing plugins
only accept string-typed configuration values.
- `DiffConfig` either returns "never replace" if all configuration
values are known or "must replace" if any configuration value is
unknown. The justification for this behavior is given
[here](https://github.com/pulumi/pulumi/pull/1695/files#diff-a6cd5c7f337665f5bb22e92ca5f07537R106)
- `Configure` converts the config bag to a legacy config map and
configures the provider plugin if all config values are known. If any
config value is unknown, the underlying plugin is not configured and
the provider may only perform `Check`, `Read`, and `Invoke`, all of
which return empty results. We justify this behavior becuase it is
only possible during a preview and provides the best experience we
can manage with the existing gRPC interface.
### Resource Model Changes
Providers are now exposed as resources that participate in a stack's
dependency graph. Like other resources, they are explicitly created,
may have multiple instances, and may have dependencies on other
resources. Providers are referred to using provider references, which
are a combination of the provider's URN and its ID. This design
addresses the need during a preview to refer to providers that have not
yet been physically created and therefore have no ID.
All custom resources that are not themselves providers must specify a
single provider via a provider reference. The named provider will be
used to manage that resource's CRUD operations. If a resource's
provider reference changes, the resource must be replaced. Though its
URN is not present in the resource's dependency list, the provider
should be treated as a dependency of the resource when topologically
sorting the dependency graph.
Finally, `Invoke` operations must now specify a provider to use for the
invocation via a provider reference.
### Engine Changes
First-class providers support requires a few changes to the engine:
- The engine must have some way to map from provider references to
provider plugins. It must be possible to add providers from a stack's
checkpoint to this map and to register new/updated providers during
the execution of a plan in response to CRUD operations on provider
resources.
- In order to support updating existing stacks using existing Pulumi
programs that may not explicitly instantiate providers, the engine
must be able to manage the "default" providers for each package
referenced by a checkpoint or Pulumi program. The configuration for
a "default" provider is taken from the stack's configuration data.
The former need is addressed by adding a provider registry type that is
responsible for managing all of the plugins required by a plan. In
addition to loading plugins froma checkpoint and providing the ability
to map from a provider reference to a provider plugin, this type serves
as the provider plugin for providers themselves (i.e. it is the
"provider provider").
The latter need is solved via two relatively self-contained changes to
plan setup and the eval source.
During plan setup, the old checkpoint is scanned for custom resources
that do not have a provider reference in order to compute the set of
packages that require a default provider. Once this set has been
computed, the required default provider definitions are conjured and
prepended to the checkpoint's resource list. Each resource that
requires a default provider is then updated to refer to the default
provider for its package.
While an eval source is running, each custom resource registration,
resource read, and invoke that does not name a provider is trapped
before being returned by the source iterator. If no default provider
for the appropriate package has been registered, the eval source
synthesizes an appropriate registration, waits for it to complete, and
records the registered provider's reference. This reference is injected
into the original request, which is then processed as usual. If a
default provider was already registered, the recorded reference is
used and no new registration occurs.
### SDK Changes
These changes only expose first-class providers from the Node.JS SDK.
- A new abstract class, `ProviderResource`, can be subclassed and used
to instantiate first-class providers.
- A new field in `ResourceOptions`, `provider`, can be used to supply
a particular provider instance to manage a `CustomResource`'s CRUD
operations.
- A new type, `InvokeOptions`, can be used to specify options that
control the behavior of a call to `pulumi.runtime.invoke`. This type
includes a `provider` field that is analogous to
`ResourceOptions.provider`.
2018-08-07 00:50:29 +00:00
|
|
|
if err != nil {
|
2018-10-20 00:22:50 +00:00
|
|
|
return nil, errors.Errorf("could not load plugin for %v provider '%v': %v", providerPkg, urn, err)
|
|
|
|
}
|
|
|
|
if provider == nil {
|
|
|
|
return nil, errors.Errorf("could not find plugin for %v provider '%v' at version %v", providerPkg, urn, version)
|
Implement first-class providers. (#1695)
### First-Class Providers
These changes implement support for first-class providers. First-class
providers are provider plugins that are exposed as resources via the
Pulumi programming model so that they may be explicitly and multiply
instantiated. Each instance of a provider resource may be configured
differently, and configuration parameters may be source from the
outputs of other resources.
### Provider Plugin Changes
In order to accommodate the need to verify and diff provider
configuration and configure providers without complete configuration
information, these changes adjust the high-level provider plugin
interface. Two new methods for validating a provider's configuration
and diffing changes to the same have been added (`CheckConfig` and
`DiffConfig`, respectively), and the type of the configuration bag
accepted by `Configure` has been changed to a `PropertyMap`.
These changes have not yet been reflected in the provider plugin gRPC
interface. We will do this in a set of follow-up changes. Until then,
these methods are implemented by adapters:
- `CheckConfig` validates that all configuration parameters are string
or unknown properties. This is necessary because existing plugins
only accept string-typed configuration values.
- `DiffConfig` either returns "never replace" if all configuration
values are known or "must replace" if any configuration value is
unknown. The justification for this behavior is given
[here](https://github.com/pulumi/pulumi/pull/1695/files#diff-a6cd5c7f337665f5bb22e92ca5f07537R106)
- `Configure` converts the config bag to a legacy config map and
configures the provider plugin if all config values are known. If any
config value is unknown, the underlying plugin is not configured and
the provider may only perform `Check`, `Read`, and `Invoke`, all of
which return empty results. We justify this behavior becuase it is
only possible during a preview and provides the best experience we
can manage with the existing gRPC interface.
### Resource Model Changes
Providers are now exposed as resources that participate in a stack's
dependency graph. Like other resources, they are explicitly created,
may have multiple instances, and may have dependencies on other
resources. Providers are referred to using provider references, which
are a combination of the provider's URN and its ID. This design
addresses the need during a preview to refer to providers that have not
yet been physically created and therefore have no ID.
All custom resources that are not themselves providers must specify a
single provider via a provider reference. The named provider will be
used to manage that resource's CRUD operations. If a resource's
provider reference changes, the resource must be replaced. Though its
URN is not present in the resource's dependency list, the provider
should be treated as a dependency of the resource when topologically
sorting the dependency graph.
Finally, `Invoke` operations must now specify a provider to use for the
invocation via a provider reference.
### Engine Changes
First-class providers support requires a few changes to the engine:
- The engine must have some way to map from provider references to
provider plugins. It must be possible to add providers from a stack's
checkpoint to this map and to register new/updated providers during
the execution of a plan in response to CRUD operations on provider
resources.
- In order to support updating existing stacks using existing Pulumi
programs that may not explicitly instantiate providers, the engine
must be able to manage the "default" providers for each package
referenced by a checkpoint or Pulumi program. The configuration for
a "default" provider is taken from the stack's configuration data.
The former need is addressed by adding a provider registry type that is
responsible for managing all of the plugins required by a plan. In
addition to loading plugins froma checkpoint and providing the ability
to map from a provider reference to a provider plugin, this type serves
as the provider plugin for providers themselves (i.e. it is the
"provider provider").
The latter need is solved via two relatively self-contained changes to
plan setup and the eval source.
During plan setup, the old checkpoint is scanned for custom resources
that do not have a provider reference in order to compute the set of
packages that require a default provider. Once this set has been
computed, the required default provider definitions are conjured and
prepended to the checkpoint's resource list. Each resource that
requires a default provider is then updated to refer to the default
provider for its package.
While an eval source is running, each custom resource registration,
resource read, and invoke that does not name a provider is trapped
before being returned by the source iterator. If no default provider
for the appropriate package has been registered, the eval source
synthesizes an appropriate registration, waits for it to complete, and
records the registered provider's reference. This reference is injected
into the original request, which is then processed as usual. If a
default provider was already registered, the recorded reference is
used and no new registration occurs.
### SDK Changes
These changes only expose first-class providers from the Node.JS SDK.
- A new abstract class, `ProviderResource`, can be subclassed and used
to instantiate first-class providers.
- A new field in `ResourceOptions`, `provider`, can be used to supply
a particular provider instance to manage a `CustomResource`'s CRUD
operations.
- A new type, `InvokeOptions`, can be used to specify options that
control the behavior of a call to `pulumi.runtime.invoke`. This type
includes a `provider` field that is analogous to
`ResourceOptions.provider`.
2018-08-07 00:50:29 +00:00
|
|
|
}
|
|
|
|
if err := provider.Configure(res.Inputs); err != nil {
|
|
|
|
closeErr := host.CloseProvider(provider)
|
|
|
|
contract.IgnoreError(closeErr)
|
|
|
|
return nil, errors.Errorf("could not configure provider '%v': %v", urn, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
logging.V(7).Infof("loaded provider %v", ref)
|
|
|
|
r.providers[ref] = provider
|
|
|
|
}
|
|
|
|
|
|
|
|
return r, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetProvider returns the provider plugin that is currently registered under the given reference, if any.
|
|
|
|
func (r *Registry) GetProvider(ref Reference) (plugin.Provider, bool) {
|
|
|
|
r.m.RLock()
|
|
|
|
defer r.m.RUnlock()
|
|
|
|
|
|
|
|
logging.V(7).Infof("GetProvider(%v)", ref)
|
|
|
|
|
|
|
|
provider, ok := r.providers[ref]
|
|
|
|
return provider, ok
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) setProvider(ref Reference, provider plugin.Provider) {
|
|
|
|
r.m.Lock()
|
|
|
|
defer r.m.Unlock()
|
|
|
|
|
|
|
|
logging.V(7).Infof("setProvider(%v)", ref)
|
|
|
|
|
|
|
|
r.providers[ref] = provider
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) deleteProvider(ref Reference) (plugin.Provider, bool) {
|
|
|
|
r.m.Lock()
|
|
|
|
defer r.m.Unlock()
|
|
|
|
|
|
|
|
provider, ok := r.providers[ref]
|
|
|
|
if !ok {
|
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
delete(r.providers, ref)
|
|
|
|
return provider, true
|
|
|
|
}
|
|
|
|
|
|
|
|
// The rest of the methods below are the implementation of the plugin.Provider interface methods.
|
|
|
|
|
|
|
|
func (r *Registry) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) Pkg() tokens.Package {
|
|
|
|
return "pulumi"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) label() string {
|
|
|
|
return "ProviderRegistry"
|
|
|
|
}
|
|
|
|
|
|
|
|
// CheckConfig validates the configuration for this resource provider.
|
|
|
|
func (r *Registry) CheckConfig(olds, news resource.PropertyMap) (resource.PropertyMap, []plugin.CheckFailure, error) {
|
|
|
|
contract.Fail()
|
|
|
|
return nil, nil, errors.New("the provider registry is not configurable")
|
|
|
|
}
|
|
|
|
|
|
|
|
// DiffConfig checks what impacts a hypothetical change to this provider's configuration will have on the provider.
|
|
|
|
func (r *Registry) DiffConfig(olds, news resource.PropertyMap) (plugin.DiffResult, error) {
|
|
|
|
contract.Fail()
|
|
|
|
return plugin.DiffResult{}, errors.New("the provider registry is not configurable")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) Configure(props resource.PropertyMap) error {
|
|
|
|
contract.Fail()
|
|
|
|
return errors.New("the provider registry is not configurable")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check validates the configuration for a particular provider resource.
|
|
|
|
//
|
|
|
|
// The particulars of Check are a bit subtle for a few reasons:
|
|
|
|
// - we need to load the provider for the package indicated by the type name portion provider resource's URN in order
|
|
|
|
// to check its config
|
|
|
|
// - we need to keep the newly-loaded provider around in case we need to diff its config
|
|
|
|
// - if we are running a preview, we need to configure the provider, as its corresponding CRUD operations will not run
|
|
|
|
// (we would normally configure the provider in Create or Update).
|
|
|
|
func (r *Registry) Check(urn resource.URN, olds, news resource.PropertyMap,
|
|
|
|
allowUnknowns bool) (resource.PropertyMap, []plugin.CheckFailure, error) {
|
|
|
|
|
|
|
|
contract.Require(IsProviderType(urn.Type()), "urn")
|
|
|
|
|
|
|
|
label := fmt.Sprintf("%s.Check(%s)", r.label(), urn)
|
|
|
|
logging.V(7).Infof("%s executing (#olds=%d,#news=%d", label, len(olds), len(news))
|
|
|
|
|
|
|
|
// Parse the version from the provider properties and load the provider.
|
|
|
|
version, err := getProviderVersion(news)
|
|
|
|
if err != nil {
|
|
|
|
return nil, []plugin.CheckFailure{{Property: "version", Reason: err.Error()}}, nil
|
|
|
|
}
|
|
|
|
provider, err := r.host.Provider(getProviderPackage(urn.Type()), version)
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
2018-08-07 18:01:08 +00:00
|
|
|
if provider == nil {
|
|
|
|
return nil, nil, errors.New("could not find plugin")
|
|
|
|
}
|
Implement first-class providers. (#1695)
### First-Class Providers
These changes implement support for first-class providers. First-class
providers are provider plugins that are exposed as resources via the
Pulumi programming model so that they may be explicitly and multiply
instantiated. Each instance of a provider resource may be configured
differently, and configuration parameters may be source from the
outputs of other resources.
### Provider Plugin Changes
In order to accommodate the need to verify and diff provider
configuration and configure providers without complete configuration
information, these changes adjust the high-level provider plugin
interface. Two new methods for validating a provider's configuration
and diffing changes to the same have been added (`CheckConfig` and
`DiffConfig`, respectively), and the type of the configuration bag
accepted by `Configure` has been changed to a `PropertyMap`.
These changes have not yet been reflected in the provider plugin gRPC
interface. We will do this in a set of follow-up changes. Until then,
these methods are implemented by adapters:
- `CheckConfig` validates that all configuration parameters are string
or unknown properties. This is necessary because existing plugins
only accept string-typed configuration values.
- `DiffConfig` either returns "never replace" if all configuration
values are known or "must replace" if any configuration value is
unknown. The justification for this behavior is given
[here](https://github.com/pulumi/pulumi/pull/1695/files#diff-a6cd5c7f337665f5bb22e92ca5f07537R106)
- `Configure` converts the config bag to a legacy config map and
configures the provider plugin if all config values are known. If any
config value is unknown, the underlying plugin is not configured and
the provider may only perform `Check`, `Read`, and `Invoke`, all of
which return empty results. We justify this behavior becuase it is
only possible during a preview and provides the best experience we
can manage with the existing gRPC interface.
### Resource Model Changes
Providers are now exposed as resources that participate in a stack's
dependency graph. Like other resources, they are explicitly created,
may have multiple instances, and may have dependencies on other
resources. Providers are referred to using provider references, which
are a combination of the provider's URN and its ID. This design
addresses the need during a preview to refer to providers that have not
yet been physically created and therefore have no ID.
All custom resources that are not themselves providers must specify a
single provider via a provider reference. The named provider will be
used to manage that resource's CRUD operations. If a resource's
provider reference changes, the resource must be replaced. Though its
URN is not present in the resource's dependency list, the provider
should be treated as a dependency of the resource when topologically
sorting the dependency graph.
Finally, `Invoke` operations must now specify a provider to use for the
invocation via a provider reference.
### Engine Changes
First-class providers support requires a few changes to the engine:
- The engine must have some way to map from provider references to
provider plugins. It must be possible to add providers from a stack's
checkpoint to this map and to register new/updated providers during
the execution of a plan in response to CRUD operations on provider
resources.
- In order to support updating existing stacks using existing Pulumi
programs that may not explicitly instantiate providers, the engine
must be able to manage the "default" providers for each package
referenced by a checkpoint or Pulumi program. The configuration for
a "default" provider is taken from the stack's configuration data.
The former need is addressed by adding a provider registry type that is
responsible for managing all of the plugins required by a plan. In
addition to loading plugins froma checkpoint and providing the ability
to map from a provider reference to a provider plugin, this type serves
as the provider plugin for providers themselves (i.e. it is the
"provider provider").
The latter need is solved via two relatively self-contained changes to
plan setup and the eval source.
During plan setup, the old checkpoint is scanned for custom resources
that do not have a provider reference in order to compute the set of
packages that require a default provider. Once this set has been
computed, the required default provider definitions are conjured and
prepended to the checkpoint's resource list. Each resource that
requires a default provider is then updated to refer to the default
provider for its package.
While an eval source is running, each custom resource registration,
resource read, and invoke that does not name a provider is trapped
before being returned by the source iterator. If no default provider
for the appropriate package has been registered, the eval source
synthesizes an appropriate registration, waits for it to complete, and
records the registered provider's reference. This reference is injected
into the original request, which is then processed as usual. If a
default provider was already registered, the recorded reference is
used and no new registration occurs.
### SDK Changes
These changes only expose first-class providers from the Node.JS SDK.
- A new abstract class, `ProviderResource`, can be subclassed and used
to instantiate first-class providers.
- A new field in `ResourceOptions`, `provider`, can be used to supply
a particular provider instance to manage a `CustomResource`'s CRUD
operations.
- A new type, `InvokeOptions`, can be used to specify options that
control the behavior of a call to `pulumi.runtime.invoke`. This type
includes a `provider` field that is analogous to
`ResourceOptions.provider`.
2018-08-07 00:50:29 +00:00
|
|
|
|
|
|
|
// Check the provider's config. If the check fails, unload the provider.
|
|
|
|
inputs, failures, err := provider.CheckConfig(olds, news)
|
|
|
|
if len(failures) != 0 || err != nil {
|
|
|
|
closeErr := r.host.CloseProvider(provider)
|
|
|
|
contract.IgnoreError(closeErr)
|
|
|
|
return nil, failures, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we are running a preview, configure the provider now. If we are not running a preview, we will configure the
|
|
|
|
// provider when it is created or updated.
|
|
|
|
if r.isPreview {
|
|
|
|
if err := provider.Configure(inputs); err != nil {
|
|
|
|
closeErr := r.host.CloseProvider(provider)
|
|
|
|
contract.IgnoreError(closeErr)
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create a provider reference using the URN and the unknown ID and register the provider.
|
|
|
|
r.setProvider(mustNewReference(urn, UnknownID), provider)
|
|
|
|
|
|
|
|
return inputs, nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Diff diffs the configuration of the indicated provider. The provider corresponding to the given URN must have
|
|
|
|
// previously been loaded by a call to Check.
|
|
|
|
func (r *Registry) Diff(urn resource.URN, id resource.ID, olds, news resource.PropertyMap,
|
|
|
|
allowUnknowns bool) (plugin.DiffResult, error) {
|
|
|
|
|
|
|
|
contract.Require(id != "", "id")
|
|
|
|
|
|
|
|
label := fmt.Sprintf("%s.Diff(%s,%s)", r.label(), urn, id)
|
|
|
|
logging.V(7).Infof("%s: executing (#olds=%d,#news=%d)", label, len(olds), len(news))
|
|
|
|
|
|
|
|
// Create a reference using the URN and the unknown ID and fetch the provider.
|
|
|
|
provider, ok := r.GetProvider(mustNewReference(urn, UnknownID))
|
|
|
|
contract.Assertf(ok, "'Check' must be called before 'Diff'")
|
|
|
|
|
|
|
|
// Diff the properties.
|
|
|
|
diff, err := provider.DiffConfig(olds, news)
|
|
|
|
if err != nil {
|
|
|
|
return plugin.DiffResult{Changes: plugin.DiffUnknown}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the diff requires replacement, unload the provider: the engine will reload it during its replacememnt Check.
|
|
|
|
//
|
|
|
|
// If the diff does not require replacement and we are running a preview, register it under its current ID so that
|
|
|
|
// references to the provider from other resources will resolve properly.
|
|
|
|
if len(diff.ReplaceKeys) != 0 {
|
|
|
|
closeErr := r.host.CloseProvider(provider)
|
|
|
|
contract.IgnoreError(closeErr)
|
|
|
|
} else if r.isPreview {
|
|
|
|
r.setProvider(mustNewReference(urn, id), provider)
|
|
|
|
}
|
|
|
|
|
|
|
|
return diff, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create coonfigures the provider with the given URN using the indicated configuration, assigns it an ID, and
|
|
|
|
// registers it under the assigned (URN, ID).
|
|
|
|
//
|
|
|
|
// The provider must have been loaded by a prior call to Check.
|
|
|
|
func (r *Registry) Create(urn resource.URN,
|
|
|
|
news resource.PropertyMap) (resource.ID, resource.PropertyMap, resource.Status, error) {
|
|
|
|
|
|
|
|
contract.Assert(!r.isPreview)
|
|
|
|
|
|
|
|
label := fmt.Sprintf("%s.Create(%s)", r.label(), urn)
|
|
|
|
logging.V(7).Infof("%s executing (#news=%v)", label, len(news))
|
|
|
|
|
|
|
|
// Fetch the unconfigured provider, configure it, and register it under a new ID.
|
|
|
|
provider, ok := r.GetProvider(mustNewReference(urn, UnknownID))
|
|
|
|
contract.Assertf(ok, "'Check' must be called before 'Create'")
|
|
|
|
|
|
|
|
if err := provider.Configure(news); err != nil {
|
|
|
|
return "", nil, resource.StatusOK, err
|
|
|
|
}
|
|
|
|
|
|
|
|
id := resource.ID(uuid.NewV4().String())
|
|
|
|
contract.Assert(id != UnknownID)
|
|
|
|
|
|
|
|
r.setProvider(mustNewReference(urn, id), provider)
|
|
|
|
return id, resource.PropertyMap{}, resource.StatusOK, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update configures the provider with the given URN and ID using the indicated configuration and registers it at the
|
|
|
|
// reference indicated by the (URN, ID) pair.
|
|
|
|
//
|
|
|
|
// THe provider must have been loaded by a prior call to Check.
|
|
|
|
func (r *Registry) Update(urn resource.URN, id resource.ID, olds,
|
|
|
|
news resource.PropertyMap) (resource.PropertyMap, resource.Status, error) {
|
|
|
|
|
|
|
|
contract.Assert(!r.isPreview)
|
|
|
|
|
|
|
|
label := fmt.Sprintf("%s.Update(%s,%s)", r.label(), id, urn)
|
|
|
|
logging.V(7).Infof("%s executing (#olds=%v,#news=%v)", label, len(olds), len(news))
|
|
|
|
|
|
|
|
// Fetch the unconfigured provider and configure it.
|
|
|
|
provider, ok := r.GetProvider(mustNewReference(urn, UnknownID))
|
|
|
|
contract.Assertf(ok, "'Check' and 'Diff' must be called before 'Update'")
|
|
|
|
|
|
|
|
if err := provider.Configure(news); err != nil {
|
|
|
|
return nil, resource.StatusUnknown, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Publish the configured provider.
|
|
|
|
r.setProvider(mustNewReference(urn, id), provider)
|
|
|
|
return resource.PropertyMap{}, resource.StatusOK, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete unregisters and unloads the provider with the given URN and ID. The provider must have been loaded when the
|
|
|
|
// registry was created (i.e. it must have been present in the state handed to NewRegistry).
|
|
|
|
func (r *Registry) Delete(urn resource.URN, id resource.ID, props resource.PropertyMap) (resource.Status, error) {
|
|
|
|
contract.Assert(!r.isPreview)
|
|
|
|
|
|
|
|
ref := mustNewReference(urn, id)
|
|
|
|
provider, has := r.deleteProvider(ref)
|
|
|
|
contract.Assert(has)
|
|
|
|
|
|
|
|
closeErr := r.host.CloseProvider(provider)
|
|
|
|
contract.IgnoreError(closeErr)
|
|
|
|
return resource.StatusOK, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) Read(urn resource.URN, id resource.ID,
|
2018-08-07 07:40:43 +00:00
|
|
|
props resource.PropertyMap) (resource.PropertyMap, resource.Status, error) {
|
|
|
|
return nil, resource.StatusUnknown, errors.New("provider resources may not be read")
|
Implement first-class providers. (#1695)
### First-Class Providers
These changes implement support for first-class providers. First-class
providers are provider plugins that are exposed as resources via the
Pulumi programming model so that they may be explicitly and multiply
instantiated. Each instance of a provider resource may be configured
differently, and configuration parameters may be source from the
outputs of other resources.
### Provider Plugin Changes
In order to accommodate the need to verify and diff provider
configuration and configure providers without complete configuration
information, these changes adjust the high-level provider plugin
interface. Two new methods for validating a provider's configuration
and diffing changes to the same have been added (`CheckConfig` and
`DiffConfig`, respectively), and the type of the configuration bag
accepted by `Configure` has been changed to a `PropertyMap`.
These changes have not yet been reflected in the provider plugin gRPC
interface. We will do this in a set of follow-up changes. Until then,
these methods are implemented by adapters:
- `CheckConfig` validates that all configuration parameters are string
or unknown properties. This is necessary because existing plugins
only accept string-typed configuration values.
- `DiffConfig` either returns "never replace" if all configuration
values are known or "must replace" if any configuration value is
unknown. The justification for this behavior is given
[here](https://github.com/pulumi/pulumi/pull/1695/files#diff-a6cd5c7f337665f5bb22e92ca5f07537R106)
- `Configure` converts the config bag to a legacy config map and
configures the provider plugin if all config values are known. If any
config value is unknown, the underlying plugin is not configured and
the provider may only perform `Check`, `Read`, and `Invoke`, all of
which return empty results. We justify this behavior becuase it is
only possible during a preview and provides the best experience we
can manage with the existing gRPC interface.
### Resource Model Changes
Providers are now exposed as resources that participate in a stack's
dependency graph. Like other resources, they are explicitly created,
may have multiple instances, and may have dependencies on other
resources. Providers are referred to using provider references, which
are a combination of the provider's URN and its ID. This design
addresses the need during a preview to refer to providers that have not
yet been physically created and therefore have no ID.
All custom resources that are not themselves providers must specify a
single provider via a provider reference. The named provider will be
used to manage that resource's CRUD operations. If a resource's
provider reference changes, the resource must be replaced. Though its
URN is not present in the resource's dependency list, the provider
should be treated as a dependency of the resource when topologically
sorting the dependency graph.
Finally, `Invoke` operations must now specify a provider to use for the
invocation via a provider reference.
### Engine Changes
First-class providers support requires a few changes to the engine:
- The engine must have some way to map from provider references to
provider plugins. It must be possible to add providers from a stack's
checkpoint to this map and to register new/updated providers during
the execution of a plan in response to CRUD operations on provider
resources.
- In order to support updating existing stacks using existing Pulumi
programs that may not explicitly instantiate providers, the engine
must be able to manage the "default" providers for each package
referenced by a checkpoint or Pulumi program. The configuration for
a "default" provider is taken from the stack's configuration data.
The former need is addressed by adding a provider registry type that is
responsible for managing all of the plugins required by a plan. In
addition to loading plugins froma checkpoint and providing the ability
to map from a provider reference to a provider plugin, this type serves
as the provider plugin for providers themselves (i.e. it is the
"provider provider").
The latter need is solved via two relatively self-contained changes to
plan setup and the eval source.
During plan setup, the old checkpoint is scanned for custom resources
that do not have a provider reference in order to compute the set of
packages that require a default provider. Once this set has been
computed, the required default provider definitions are conjured and
prepended to the checkpoint's resource list. Each resource that
requires a default provider is then updated to refer to the default
provider for its package.
While an eval source is running, each custom resource registration,
resource read, and invoke that does not name a provider is trapped
before being returned by the source iterator. If no default provider
for the appropriate package has been registered, the eval source
synthesizes an appropriate registration, waits for it to complete, and
records the registered provider's reference. This reference is injected
into the original request, which is then processed as usual. If a
default provider was already registered, the recorded reference is
used and no new registration occurs.
### SDK Changes
These changes only expose first-class providers from the Node.JS SDK.
- A new abstract class, `ProviderResource`, can be subclassed and used
to instantiate first-class providers.
- A new field in `ResourceOptions`, `provider`, can be used to supply
a particular provider instance to manage a `CustomResource`'s CRUD
operations.
- A new type, `InvokeOptions`, can be used to specify options that
control the behavior of a call to `pulumi.runtime.invoke`. This type
includes a `provider` field that is analogous to
`ResourceOptions.provider`.
2018-08-07 00:50:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) Invoke(tok tokens.ModuleMember,
|
|
|
|
args resource.PropertyMap) (resource.PropertyMap, []plugin.CheckFailure, error) {
|
|
|
|
|
|
|
|
// It is the responsibility of the eval source to ensure that we never attempt an invoke using the provider
|
|
|
|
// registry.
|
|
|
|
contract.Fail()
|
|
|
|
return nil, nil, errors.New("the provider registry is not invokable")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) GetPluginInfo() (workspace.PluginInfo, error) {
|
|
|
|
// return an error: this should not be called for the provider registry
|
|
|
|
return workspace.PluginInfo{}, errors.New("the provider registry does not report plugin info")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Registry) SignalCancellation() error {
|
|
|
|
// At the moment there isn't anything reasonable we can do here. In the future, it might be nice to plumb
|
|
|
|
// cancellation through the plugin loader and cancel any outstanding load requests here.
|
|
|
|
return nil
|
|
|
|
}
|