rename GraphNodeSubPath -> GraphNodeModuleInstance
This commit is contained in:
parent
b1df763541
commit
bd9cfca794
|
@ -52,9 +52,9 @@ func (g *Graph) walk(walker GraphWalker) tfdiags.Diagnostics {
|
|||
|
||||
// vertexCtx is the context that we use when evaluating. This
|
||||
// is normally the context of our graph but can be overridden
|
||||
// with a GraphNodeSubPath impl.
|
||||
// with a GraphNodeModuleInstance impl.
|
||||
vertexCtx := ctx
|
||||
if pn, ok := v.(GraphNodeSubPath); ok && len(pn.Path()) > 0 {
|
||||
if pn, ok := v.(GraphNodeModuleInstance); ok && len(pn.Path()) > 0 {
|
||||
vertexCtx = walker.EnterPath(pn.Path())
|
||||
defer walker.ExitPath(pn.Path())
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"github.com/hashicorp/terraform/addrs"
|
||||
)
|
||||
|
||||
// GraphNodeSubPath says that a node is part of a graph with a
|
||||
// GraphNodeModuleInstance says that a node is part of a graph with a
|
||||
// different path, and the context should be adjusted accordingly.
|
||||
type GraphNodeSubPath interface {
|
||||
type GraphNodeModuleInstance interface {
|
||||
Path() addrs.ModuleInstance
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ type NodeRefreshableDataResource struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeRefreshableDataResource)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeRefreshableDataResource)(nil)
|
||||
_ GraphNodeDynamicExpandable = (*NodeRefreshableDataResource)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeRefreshableDataResource)(nil)
|
||||
_ GraphNodeReferencer = (*NodeRefreshableDataResource)(nil)
|
||||
|
|
|
@ -17,19 +17,19 @@ type NodeLocal struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeLocal)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeLocal)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeLocal)(nil)
|
||||
_ GraphNodeReferencer = (*NodeLocal)(nil)
|
||||
_ GraphNodeEvalable = (*NodeLocal)(nil)
|
||||
_ dag.GraphNodeDotter = (*NodeLocal)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeLocal)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeLocal)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeLocal)(nil)
|
||||
_ GraphNodeReferencer = (*NodeLocal)(nil)
|
||||
_ GraphNodeEvalable = (*NodeLocal)(nil)
|
||||
_ dag.GraphNodeDotter = (*NodeLocal)(nil)
|
||||
)
|
||||
|
||||
func (n *NodeLocal) Name() string {
|
||||
return n.Addr.String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeLocal) Path() addrs.ModuleInstance {
|
||||
return n.Addr.Module
|
||||
}
|
||||
|
|
|
@ -21,17 +21,17 @@ type nodeExpandModule struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*nodeExpandModule)(nil)
|
||||
_ RemovableIfNotTargeted = (*nodeExpandModule)(nil)
|
||||
_ GraphNodeEvalable = (*nodeExpandModule)(nil)
|
||||
_ GraphNodeReferencer = (*nodeExpandModule)(nil)
|
||||
_ GraphNodeModuleInstance = (*nodeExpandModule)(nil)
|
||||
_ RemovableIfNotTargeted = (*nodeExpandModule)(nil)
|
||||
_ GraphNodeEvalable = (*nodeExpandModule)(nil)
|
||||
_ GraphNodeReferencer = (*nodeExpandModule)(nil)
|
||||
)
|
||||
|
||||
func (n *nodeExpandModule) Name() string {
|
||||
return n.CallerAddr.Child(n.Call.Name, addrs.NoKey).String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath implementation
|
||||
// GraphNodeModuleInstance implementation
|
||||
func (n *nodeExpandModule) Path() addrs.ModuleInstance {
|
||||
// This node represents the module call within a module,
|
||||
// so return the CallerAddr as the path as the module
|
||||
|
|
|
@ -13,7 +13,7 @@ type NodeModuleRemoved struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeModuleRemoved)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeModuleRemoved)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeModuleRemoved)(nil)
|
||||
_ GraphNodeEvalable = (*NodeModuleRemoved)(nil)
|
||||
_ GraphNodeReferencer = (*NodeModuleRemoved)(nil)
|
||||
|
@ -24,7 +24,7 @@ func (n *NodeModuleRemoved) Name() string {
|
|||
return fmt.Sprintf("%s (removed)", n.Addr.String())
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeModuleRemoved) Path() addrs.ModuleInstance {
|
||||
return n.Addr
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ var (
|
|||
_ GraphNodeReferenceOutside = (*NodePlannableModuleVariable)(nil)
|
||||
_ GraphNodeReferenceable = (*NodePlannableModuleVariable)(nil)
|
||||
_ GraphNodeReferencer = (*NodePlannableModuleVariable)(nil)
|
||||
_ GraphNodeSubPath = (*NodePlannableModuleVariable)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodePlannableModuleVariable)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodePlannableModuleVariable)(nil)
|
||||
)
|
||||
|
||||
|
@ -47,7 +47,7 @@ func (n *NodePlannableModuleVariable) Name() string {
|
|||
return fmt.Sprintf("%s.%s", n.Module, n.Addr.String())
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodePlannableModuleVariable) Path() addrs.ModuleInstance {
|
||||
// Return an UnkeyedInstanceShim as our placeholder,
|
||||
// given that modules will be unexpanded at this point in the walk
|
||||
|
@ -122,7 +122,7 @@ type NodeApplyableModuleVariable struct {
|
|||
// Ensure that we are implementing all of the interfaces we think we are
|
||||
// implementing.
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeApplyableModuleVariable)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeApplyableModuleVariable)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeApplyableModuleVariable)(nil)
|
||||
_ GraphNodeReferenceOutside = (*NodeApplyableModuleVariable)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeApplyableModuleVariable)(nil)
|
||||
|
@ -135,7 +135,7 @@ func (n *NodeApplyableModuleVariable) Name() string {
|
|||
return n.Addr.String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeApplyableModuleVariable) Path() addrs.ModuleInstance {
|
||||
// We execute in the parent scope (above our own module) because
|
||||
// expressions in our value are resolved in that context.
|
||||
|
|
|
@ -18,9 +18,9 @@ type NodePlannableOutput struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodePlannableOutput)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodePlannableOutput)(nil)
|
||||
_ GraphNodeReferenceable = (*NodePlannableOutput)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodePlannableOutput)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodePlannableOutput)(nil)
|
||||
_ GraphNodeReferenceable = (*NodePlannableOutput)(nil)
|
||||
//_ GraphNodeEvalable = (*NodePlannableOutput)(nil)
|
||||
_ GraphNodeReferencer = (*NodePlannableOutput)(nil)
|
||||
_ GraphNodeDynamicExpandable = (*NodePlannableOutput)(nil)
|
||||
|
@ -44,7 +44,7 @@ func (n *NodePlannableOutput) Name() string {
|
|||
return n.Addr.Absolute(n.Module.UnkeyedInstanceShim()).String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodePlannableOutput) Path() addrs.ModuleInstance {
|
||||
// Return an UnkeyedInstanceShim as our placeholder,
|
||||
// given that modules will be unexpanded at this point in the walk
|
||||
|
@ -114,7 +114,7 @@ type NodeApplyableOutput struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeApplyableOutput)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeApplyableOutput)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeApplyableOutput)(nil)
|
||||
_ GraphNodeTargetDownstream = (*NodeApplyableOutput)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeApplyableOutput)(nil)
|
||||
|
@ -128,7 +128,7 @@ func (n *NodeApplyableOutput) Name() string {
|
|||
return n.Addr.String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeApplyableOutput) Path() addrs.ModuleInstance {
|
||||
return n.Addr.Module
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ type NodeDestroyableOutput struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeDestroyableOutput)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeDestroyableOutput)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeDestroyableOutput)(nil)
|
||||
_ GraphNodeTargetDownstream = (*NodeDestroyableOutput)(nil)
|
||||
_ GraphNodeReferencer = (*NodeDestroyableOutput)(nil)
|
||||
|
@ -259,7 +259,7 @@ func (n *NodeDestroyableOutput) Name() string {
|
|||
return fmt.Sprintf("%s (destroy)", n.Addr.String())
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeDestroyableOutput) Path() addrs.ModuleInstance {
|
||||
return n.Module.UnkeyedInstanceShim()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ type NodeOutputOrphan struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeOutputOrphan)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeOutputOrphan)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeOutputOrphan)(nil)
|
||||
_ GraphNodeReferenceOutside = (*NodeOutputOrphan)(nil)
|
||||
_ GraphNodeEvalable = (*NodeOutputOrphan)(nil)
|
||||
|
@ -32,7 +32,7 @@ func (n *NodeOutputOrphan) ReferenceableAddrs() []addrs.Referenceable {
|
|||
return referenceableAddrsForOutput(n.Addr)
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeOutputOrphan) Path() addrs.ModuleInstance {
|
||||
return n.Addr.Module
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ type NodeAbstractProvider struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeAbstractProvider)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeAbstractProvider)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeAbstractProvider)(nil)
|
||||
_ GraphNodeReferencer = (*NodeAbstractProvider)(nil)
|
||||
_ GraphNodeProvider = (*NodeAbstractProvider)(nil)
|
||||
|
@ -39,7 +39,7 @@ func (n *NodeAbstractProvider) Name() string {
|
|||
return n.Addr.String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeAbstractProvider) Path() addrs.ModuleInstance {
|
||||
return n.Addr.Module
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ type NodeDisabledProvider struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeDisabledProvider)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeDisabledProvider)(nil)
|
||||
_ RemovableIfNotTargeted = (*NodeDisabledProvider)(nil)
|
||||
_ GraphNodeReferencer = (*NodeDisabledProvider)(nil)
|
||||
_ GraphNodeProvider = (*NodeDisabledProvider)(nil)
|
||||
|
|
|
@ -14,9 +14,9 @@ type NodeProvisioner struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeProvisioner)(nil)
|
||||
_ GraphNodeProvisioner = (*NodeProvisioner)(nil)
|
||||
_ GraphNodeEvalable = (*NodeProvisioner)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeProvisioner)(nil)
|
||||
_ GraphNodeProvisioner = (*NodeProvisioner)(nil)
|
||||
_ GraphNodeEvalable = (*NodeProvisioner)(nil)
|
||||
)
|
||||
|
||||
func (n *NodeProvisioner) Name() string {
|
||||
|
@ -28,7 +28,7 @@ func (n *NodeProvisioner) Name() string {
|
|||
return result
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeProvisioner) Path() addrs.ModuleInstance {
|
||||
return n.PathValue
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type NodeAbstractResource struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeAbstractResource)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeAbstractResource)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeAbstractResource)(nil)
|
||||
_ GraphNodeReferencer = (*NodeAbstractResource)(nil)
|
||||
_ GraphNodeProviderConsumer = (*NodeAbstractResource)(nil)
|
||||
|
@ -108,7 +108,7 @@ type NodeAbstractResourceInstance struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeAbstractResourceInstance)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeAbstractResourceInstance)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeAbstractResourceInstance)(nil)
|
||||
_ GraphNodeReferencer = (*NodeAbstractResourceInstance)(nil)
|
||||
_ GraphNodeProviderConsumer = (*NodeAbstractResourceInstance)(nil)
|
||||
|
@ -148,7 +148,7 @@ func (n *NodeAbstractResourceInstance) Name() string {
|
|||
return n.ResourceInstanceAddr().String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeAbstractResource) Path() addrs.ModuleInstance {
|
||||
return n.Addr.Module
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ type NodePlannableResource struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodePlannableResource)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodePlannableResource)(nil)
|
||||
_ GraphNodeDestroyerCBD = (*NodePlannableResource)(nil)
|
||||
_ GraphNodeDynamicExpandable = (*NodePlannableResource)(nil)
|
||||
_ GraphNodeReferenceable = (*NodePlannableResource)(nil)
|
||||
|
|
|
@ -17,7 +17,7 @@ type NodePlanDestroyableResourceInstance struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodePlanDestroyableResourceInstance)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodePlanDestroyableResourceInstance)(nil)
|
||||
_ GraphNodeReferenceable = (*NodePlanDestroyableResourceInstance)(nil)
|
||||
_ GraphNodeReferencer = (*NodePlanDestroyableResourceInstance)(nil)
|
||||
_ GraphNodeDestroyer = (*NodePlanDestroyableResourceInstance)(nil)
|
||||
|
|
|
@ -20,7 +20,7 @@ type NodePlannableResourceInstance struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodePlannableResourceInstance)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodePlannableResourceInstance)(nil)
|
||||
_ GraphNodeReferenceable = (*NodePlannableResourceInstance)(nil)
|
||||
_ GraphNodeReferencer = (*NodePlannableResourceInstance)(nil)
|
||||
_ GraphNodeResource = (*NodePlannableResourceInstance)(nil)
|
||||
|
|
|
@ -13,7 +13,7 @@ type NodePlannableResourceInstanceOrphan struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodePlannableResourceInstanceOrphan)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodePlannableResourceInstanceOrphan)(nil)
|
||||
_ GraphNodeReferenceable = (*NodePlannableResourceInstanceOrphan)(nil)
|
||||
_ GraphNodeReferencer = (*NodePlannableResourceInstanceOrphan)(nil)
|
||||
_ GraphNodeResource = (*NodePlannableResourceInstanceOrphan)(nil)
|
||||
|
|
|
@ -25,7 +25,7 @@ type NodeRefreshableManagedResource struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeRefreshableManagedResource)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeRefreshableManagedResource)(nil)
|
||||
_ GraphNodeDynamicExpandable = (*NodeRefreshableManagedResource)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeRefreshableManagedResource)(nil)
|
||||
_ GraphNodeReferencer = (*NodeRefreshableManagedResource)(nil)
|
||||
|
@ -142,7 +142,7 @@ type NodeRefreshableManagedResourceInstance struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeRefreshableManagedResourceInstance)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeRefreshableManagedResourceInstance)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeRefreshableManagedResourceInstance)(nil)
|
||||
_ GraphNodeReferencer = (*NodeRefreshableManagedResourceInstance)(nil)
|
||||
_ GraphNodeDestroyer = (*NodeRefreshableManagedResourceInstance)(nil)
|
||||
|
|
|
@ -15,7 +15,7 @@ type NodeValidatableResource struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeValidatableResource)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeValidatableResource)(nil)
|
||||
_ GraphNodeEvalable = (*NodeValidatableResource)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeValidatableResource)(nil)
|
||||
_ GraphNodeReferencer = (*NodeValidatableResource)(nil)
|
||||
|
|
|
@ -13,16 +13,16 @@ type NodeRootVariable struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*NodeRootVariable)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeRootVariable)(nil)
|
||||
_ dag.GraphNodeDotter = (*NodeApplyableModuleVariable)(nil)
|
||||
_ GraphNodeModuleInstance = (*NodeRootVariable)(nil)
|
||||
_ GraphNodeReferenceable = (*NodeRootVariable)(nil)
|
||||
_ dag.GraphNodeDotter = (*NodeApplyableModuleVariable)(nil)
|
||||
)
|
||||
|
||||
func (n *NodeRootVariable) Name() string {
|
||||
return n.Addr.String()
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *NodeRootVariable) Path() addrs.ModuleInstance {
|
||||
return addrs.RootModuleInstance
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
// that want provider configurations attached.
|
||||
type GraphNodeAttachProvider interface {
|
||||
// Must be implemented to determine the path for the configuration
|
||||
GraphNodeSubPath
|
||||
GraphNodeModuleInstance
|
||||
|
||||
// ProviderName with no module prefix. Example: "aws".
|
||||
ProviderAddr() addrs.AbsProviderConfig
|
||||
|
|
|
@ -48,7 +48,7 @@ type graphNodeImportState struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*graphNodeImportState)(nil)
|
||||
_ GraphNodeModuleInstance = (*graphNodeImportState)(nil)
|
||||
_ GraphNodeEvalable = (*graphNodeImportState)(nil)
|
||||
_ GraphNodeProviderConsumer = (*graphNodeImportState)(nil)
|
||||
_ GraphNodeDynamicExpandable = (*graphNodeImportState)(nil)
|
||||
|
@ -83,7 +83,7 @@ func (n *graphNodeImportState) SetProvider(addr addrs.AbsProviderConfig) {
|
|||
n.ResolvedProvider = addr
|
||||
}
|
||||
|
||||
// GraphNodeSubPath
|
||||
// GraphNodeModuleInstance
|
||||
func (n *graphNodeImportState) Path() addrs.ModuleInstance {
|
||||
return n.Addr.Module
|
||||
}
|
||||
|
@ -199,8 +199,8 @@ type graphNodeImportStateSub struct {
|
|||
}
|
||||
|
||||
var (
|
||||
_ GraphNodeSubPath = (*graphNodeImportStateSub)(nil)
|
||||
_ GraphNodeEvalable = (*graphNodeImportStateSub)(nil)
|
||||
_ GraphNodeModuleInstance = (*graphNodeImportStateSub)(nil)
|
||||
_ GraphNodeEvalable = (*graphNodeImportStateSub)(nil)
|
||||
)
|
||||
|
||||
func (n *graphNodeImportStateSub) Name() string {
|
||||
|
|
|
@ -65,7 +65,7 @@ func (t *ModuleExpansionTransformer) transform(g *Graph, c *configs.Config, pare
|
|||
// work to properly support "count" and "for_each" for modules. Nodes
|
||||
// in the plan graph actually belong to modules, not to module instances.
|
||||
for _, childV := range g.Vertices() {
|
||||
pather, ok := childV.(GraphNodeSubPath)
|
||||
pather, ok := childV.(GraphNodeModuleInstance)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ func TransformProviders(providers []string, concrete ConcreteProviderNodeFunc, c
|
|||
//
|
||||
// Name returns the full name of the provider in the config.
|
||||
type GraphNodeProvider interface {
|
||||
GraphNodeSubPath
|
||||
GraphNodeModuleInstance
|
||||
ProviderAddr() addrs.AbsProviderConfig
|
||||
Name() string
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ type GraphNodeProvider interface {
|
|||
// provider must implement. The CloseProviderName returned is the name of
|
||||
// the provider they satisfy.
|
||||
type GraphNodeCloseProvider interface {
|
||||
GraphNodeSubPath
|
||||
GraphNodeModuleInstance
|
||||
CloseProviderAddr() addrs.AbsProviderConfig
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
|
|||
p := req.Addr
|
||||
target := m[key]
|
||||
|
||||
_, ok := v.(GraphNodeSubPath)
|
||||
_, ok := v.(GraphNodeModuleInstance)
|
||||
if !ok && target == nil {
|
||||
// No target and no path to traverse up from
|
||||
diags = diags.Append(fmt.Errorf("%s: provider %s couldn't be found", dag.VertexName(v), p))
|
||||
|
@ -412,7 +412,7 @@ func (t *MissingProviderTransformer) Transform(g *Graph) error {
|
|||
// ParentProviderTransformer connects provider nodes to their parents.
|
||||
//
|
||||
// This works by finding nodes that are both GraphNodeProviders and
|
||||
// GraphNodeSubPath. It then connects the providers to their parent
|
||||
// GraphNodeModuleInstance. It then connects the providers to their parent
|
||||
// path. The parent provider is always at the root level.
|
||||
type ParentProviderTransformer struct{}
|
||||
|
||||
|
@ -511,7 +511,7 @@ func (n *graphNodeCloseProvider) Name() string {
|
|||
return n.Addr.String() + " (close)"
|
||||
}
|
||||
|
||||
// GraphNodeSubPath impl.
|
||||
// GraphNodeModuleInstance impl.
|
||||
func (n *graphNodeCloseProvider) Path() addrs.ModuleInstance {
|
||||
return n.Addr.Module
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ func (m *ReferenceMap) mapKey(path addrs.Module, addr addrs.Referenceable) strin
|
|||
// referenced. This is the path that its results from ReferenceableAddrs
|
||||
// are considered to be relative to.
|
||||
//
|
||||
// Only GraphNodeSubPath implementations can be referenced, so this method will
|
||||
// Only GraphNodeModuleInstance implementations can be referenced, so this method will
|
||||
// panic if the given vertex does not implement that interface.
|
||||
func vertexReferenceablePath(v dag.Vertex) addrs.Module {
|
||||
sp, ok := v.(GraphNodeModulePath)
|
||||
|
@ -316,7 +316,7 @@ func vertexReferenceablePath(v dag.Vertex) addrs.Module {
|
|||
// vertexReferencePath returns the path in which references _from_ the given
|
||||
// vertex must be interpreted.
|
||||
//
|
||||
// Only GraphNodeSubPath implementations can have references, so this method
|
||||
// Only GraphNodeModuleInstance implementations can have references, so this method
|
||||
// will panic if the given vertex does not implement that interface.
|
||||
func vertexReferencePath(v dag.Vertex) addrs.Module {
|
||||
sp, ok := v.(GraphNodeModulePath)
|
||||
|
@ -344,7 +344,7 @@ func vertexReferencePath(v dag.Vertex) addrs.Module {
|
|||
// The result is an opaque string that includes both the address of the given
|
||||
// object and the address of the module instance that object belongs to.
|
||||
//
|
||||
// Only GraphNodeSubPath implementations can be referrers, so this method will
|
||||
// Only GraphNodeModuleInstance implementations can be referrers, so this method will
|
||||
// panic if the given vertex does not implement that interface.
|
||||
func (m *ReferenceMap) referenceMapKey(referrer dag.Vertex, addr addrs.Referenceable) string {
|
||||
path := vertexReferencePath(referrer)
|
||||
|
@ -359,7 +359,7 @@ func NewReferenceMap(vs []dag.Vertex) *ReferenceMap {
|
|||
// Build the lookup table
|
||||
vertices := make(map[string][]dag.Vertex)
|
||||
for _, v := range vs {
|
||||
_, ok := v.(GraphNodeSubPath)
|
||||
_, ok := v.(GraphNodeModuleInstance)
|
||||
if !ok {
|
||||
// Only nodes with paths can participate in a reference map.
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue