rename plannable output
NodePlannableOutput is now the expander node, and is used in contexts other than planning. Change the name to nodeExpandOutput
This commit is contained in:
parent
3a3eaa1ddf
commit
5cb6c86b32
|
@ -10,28 +10,28 @@ import (
|
||||||
"github.com/hashicorp/terraform/lang"
|
"github.com/hashicorp/terraform/lang"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodePlannableOutput is the placeholder for an output that has not yet had
|
// nodeExpandOutput is the placeholder for an output that has not yet had
|
||||||
// its module path expanded.
|
// its module path expanded.
|
||||||
type NodePlannableOutput struct {
|
type nodeExpandOutput struct {
|
||||||
Addr addrs.OutputValue
|
Addr addrs.OutputValue
|
||||||
Module addrs.Module
|
Module addrs.Module
|
||||||
Config *configs.Output
|
Config *configs.Output
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ RemovableIfNotTargeted = (*NodePlannableOutput)(nil)
|
_ RemovableIfNotTargeted = (*nodeExpandOutput)(nil)
|
||||||
_ GraphNodeReferenceable = (*NodePlannableOutput)(nil)
|
_ GraphNodeReferenceable = (*nodeExpandOutput)(nil)
|
||||||
_ GraphNodeReferencer = (*NodePlannableOutput)(nil)
|
_ GraphNodeReferencer = (*nodeExpandOutput)(nil)
|
||||||
_ GraphNodeDynamicExpandable = (*NodePlannableOutput)(nil)
|
_ GraphNodeDynamicExpandable = (*nodeExpandOutput)(nil)
|
||||||
_ graphNodeTemporaryValue = (*NodeApplyableOutput)(nil)
|
_ graphNodeTemporaryValue = (*NodeApplyableOutput)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
func (n *NodePlannableOutput) temporaryValue() bool {
|
func (n *nodeExpandOutput) temporaryValue() bool {
|
||||||
// this must always be evaluated if it is a root module output
|
// this must always be evaluated if it is a root module output
|
||||||
return !n.Module.IsRoot()
|
return !n.Module.IsRoot()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NodePlannableOutput) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
func (n *nodeExpandOutput) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
||||||
var g Graph
|
var g Graph
|
||||||
expander := ctx.InstanceExpander()
|
expander := ctx.InstanceExpander()
|
||||||
for _, module := range expander.ExpandModule(n.Module) {
|
for _, module := range expander.ExpandModule(n.Module) {
|
||||||
|
@ -45,9 +45,9 @@ func (n *NodePlannableOutput) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
||||||
return &g, nil
|
return &g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NodePlannableOutput) Name() string {
|
func (n *nodeExpandOutput) Name() string {
|
||||||
path := n.Module.String()
|
path := n.Module.String()
|
||||||
addr := n.Addr.String()
|
addr := n.Addr.String() + " (expand)"
|
||||||
if path != "" {
|
if path != "" {
|
||||||
return path + "." + addr
|
return path + "." + addr
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,12 @@ func (n *NodePlannableOutput) Name() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeModulePath
|
// GraphNodeModulePath
|
||||||
func (n *NodePlannableOutput) ModulePath() addrs.Module {
|
func (n *nodeExpandOutput) ModulePath() addrs.Module {
|
||||||
return n.Module
|
return n.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeReferenceable
|
// GraphNodeReferenceable
|
||||||
func (n *NodePlannableOutput) ReferenceableAddrs() []addrs.Referenceable {
|
func (n *nodeExpandOutput) ReferenceableAddrs() []addrs.Referenceable {
|
||||||
// An output in the root module can't be referenced at all.
|
// An output in the root module can't be referenced at all.
|
||||||
if n.Module.IsRoot() {
|
if n.Module.IsRoot() {
|
||||||
return nil
|
return nil
|
||||||
|
@ -80,7 +80,7 @@ func (n *NodePlannableOutput) ReferenceableAddrs() []addrs.Referenceable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeReferenceOutside implementation
|
// GraphNodeReferenceOutside implementation
|
||||||
func (n *NodePlannableOutput) ReferenceOutside() (selfPath, referencePath addrs.Module) {
|
func (n *nodeExpandOutput) ReferenceOutside() (selfPath, referencePath addrs.Module) {
|
||||||
// Output values have their expressions resolved in the context of the
|
// Output values have their expressions resolved in the context of the
|
||||||
// module where they are defined.
|
// module where they are defined.
|
||||||
referencePath = n.Module
|
referencePath = n.Module
|
||||||
|
@ -92,17 +92,17 @@ func (n *NodePlannableOutput) ReferenceOutside() (selfPath, referencePath addrs.
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeReferencer
|
// GraphNodeReferencer
|
||||||
func (n *NodePlannableOutput) References() []*addrs.Reference {
|
func (n *nodeExpandOutput) References() []*addrs.Reference {
|
||||||
return appendResourceDestroyReferences(referencesForOutput(n.Config))
|
return appendResourceDestroyReferences(referencesForOutput(n.Config))
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemovableIfNotTargeted
|
// RemovableIfNotTargeted
|
||||||
func (n *NodePlannableOutput) RemoveIfNotTargeted() bool {
|
func (n *nodeExpandOutput) RemoveIfNotTargeted() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeTargetDownstream
|
// GraphNodeTargetDownstream
|
||||||
func (n *NodePlannableOutput) TargetDownstream(targetedDeps, untargetedDeps dag.Set) bool {
|
func (n *nodeExpandOutput) TargetDownstream(targetedDeps, untargetedDeps dag.Set) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (t *OutputTransformer) transform(g *Graph, c *configs.Config) error {
|
||||||
// into NodeApplyableOutputs to reflect possible expansion
|
// into NodeApplyableOutputs to reflect possible expansion
|
||||||
// through the presence of "count" or "for_each" on the modules.
|
// through the presence of "count" or "for_each" on the modules.
|
||||||
for _, o := range c.Module.Outputs {
|
for _, o := range c.Module.Outputs {
|
||||||
node := &NodePlannableOutput{
|
node := &nodeExpandOutput{
|
||||||
Addr: addrs.OutputValue{Name: o.Name},
|
Addr: addrs.OutputValue{Name: o.Name},
|
||||||
Module: c.Path,
|
Module: c.Path,
|
||||||
Config: o,
|
Config: o,
|
||||||
|
@ -67,7 +67,7 @@ func (t *DestroyOutputTransformer) Transform(g *Graph) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range g.Vertices() {
|
for _, v := range g.Vertices() {
|
||||||
output, ok := v.(*NodePlannableOutput)
|
output, ok := v.(*nodeExpandOutput)
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue