mirror of
https://github.com/opentofu/opentofu.git
synced 2026-05-28 04:15:54 -04:00
Add comments on partial GraphNodeProvider implementation
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
parent
ca5b1ca650
commit
a1829fc8bd
4 changed files with 15 additions and 5 deletions
|
|
@ -57,7 +57,7 @@ type NodeApplyableProvider struct {
|
|||
|
||||
var (
|
||||
_ GraphNodeExecutable = (*NodeApplyableProvider)(nil)
|
||||
_ GraphNodeProvider = (*NodeApplyableProvider)(nil)
|
||||
_ GraphNodeProvider = (*NodeApplyableProvider)(nil) // Partial, see NodeAbstractProvider
|
||||
)
|
||||
|
||||
// GraphNodeProvider
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ import (
|
|||
type ConcreteProviderNodeFunc func(*NodeAbstractProvider) dag.Vertex
|
||||
|
||||
// NodeAbstractProvider represents a provider that has no associated operations.
|
||||
// It registers all the common interfaces across operations for providers.
|
||||
// It registers all the common interfaces across operations for providers, except
|
||||
// for GraphNodeProvider as that depends on additional implementation details.
|
||||
// It does however implement what methods it can from GraphNodeProvider to reduce
|
||||
// duplication between concrete implementations.
|
||||
type NodeAbstractProvider struct {
|
||||
Addr addrs.AbsProviderConfig
|
||||
|
||||
|
|
@ -63,12 +66,12 @@ func (n *NodeAbstractProvider) References() []*addrs.Reference {
|
|||
return ReferencesFromConfig(n.Config.Config, n.Schema)
|
||||
}
|
||||
|
||||
// GraphNodeProvider
|
||||
// GraphNodeProvider (Partial Implementation)
|
||||
func (n *NodeAbstractProvider) ProviderAddr() addrs.AbsProviderConfig {
|
||||
return n.Addr
|
||||
}
|
||||
|
||||
// GraphNodeProvider
|
||||
// GraphNodeProvider (Partial Implementation)
|
||||
func (n *NodeAbstractProvider) ProviderConfig() *configs.Provider {
|
||||
if n.Config == nil {
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ type NodeEvalableProvider struct {
|
|||
}
|
||||
|
||||
var _ GraphNodeExecutable = (*NodeEvalableProvider)(nil)
|
||||
var _ GraphNodeProvider = (*NodeEvalableProvider)(nil)
|
||||
var _ GraphNodeProvider = (*NodeEvalableProvider)(nil) // Partial, see NodeAbstractProvider
|
||||
|
||||
// GraphNodeProvider
|
||||
func (n *NodeEvalableProvider) Instance(key addrs.InstanceKey) providers.Configured {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,14 @@ type GraphNodeProvider interface {
|
|||
GraphNodeModulePath
|
||||
ProviderAddr() addrs.AbsProviderConfig
|
||||
Name() string
|
||||
// Retrieve the instance specified by the key.
|
||||
// With the limited implementation of provider for_each, we only support
|
||||
// keys after the AbsProviderConfig level and not at any of the modules it may live in
|
||||
// This is a hard requirement that we have determined it is too hard to change,
|
||||
// which is an extension of the "provider configurations may not live in modules with
|
||||
// expansion" that we ensure within the configuration.
|
||||
Instance(addrs.InstanceKey) providers.Configured
|
||||
// Call close for all provider instances within this GraphNodeProvider
|
||||
Close(ctx context.Context) error
|
||||
// For test framework
|
||||
MocksAndOverrides() (IsMocked bool, MockResources []*configs.MockResource, OverrideResources []*configs.OverrideResource)
|
||||
|
|
|
|||
Loading…
Reference in a new issue