rename plannable local
NodePLannableLocal is now the expander node, and is is also used in contexts other than plan. Change the name to nodeExpandLocal.
This commit is contained in:
parent
a2d2ce35dc
commit
3a3eaa1ddf
|
@ -9,58 +9,59 @@ import (
|
||||||
"github.com/hashicorp/terraform/lang"
|
"github.com/hashicorp/terraform/lang"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodePlannableLocal represents a named local value in a configuration module,
|
// nodeExpandLocal represents a named local value in a configuration module,
|
||||||
// which has not yet been expanded.
|
// which has not yet been expanded.
|
||||||
type NodePlannableLocal struct {
|
type nodeExpandLocal struct {
|
||||||
Addr addrs.LocalValue
|
Addr addrs.LocalValue
|
||||||
Module addrs.Module
|
Module addrs.Module
|
||||||
Config *configs.Local
|
Config *configs.Local
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ RemovableIfNotTargeted = (*NodePlannableLocal)(nil)
|
_ RemovableIfNotTargeted = (*nodeExpandLocal)(nil)
|
||||||
_ GraphNodeReferenceable = (*NodePlannableLocal)(nil)
|
_ GraphNodeReferenceable = (*nodeExpandLocal)(nil)
|
||||||
_ GraphNodeReferencer = (*NodePlannableLocal)(nil)
|
_ GraphNodeReferencer = (*nodeExpandLocal)(nil)
|
||||||
_ GraphNodeDynamicExpandable = (*NodePlannableLocal)(nil)
|
_ GraphNodeDynamicExpandable = (*nodeExpandLocal)(nil)
|
||||||
_ graphNodeTemporaryValue = (*NodePlannableLocal)(nil)
|
_ graphNodeTemporaryValue = (*nodeExpandLocal)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// graphNodeTemporaryValue
|
// graphNodeTemporaryValue
|
||||||
func (n *NodePlannableLocal) temporaryValue() bool {
|
func (n *nodeExpandLocal) temporaryValue() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NodePlannableLocal) Name() string {
|
func (n *nodeExpandLocal) 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
|
||||||
}
|
}
|
||||||
return addr + " (expand)"
|
return addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeModulePath
|
// GraphNodeModulePath
|
||||||
func (n *NodePlannableLocal) ModulePath() addrs.Module {
|
func (n *nodeExpandLocal) ModulePath() addrs.Module {
|
||||||
return n.Module
|
return n.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemovableIfNotTargeted
|
// RemovableIfNotTargeted
|
||||||
func (n *NodePlannableLocal) RemoveIfNotTargeted() bool {
|
func (n *nodeExpandLocal) RemoveIfNotTargeted() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeReferenceable
|
// GraphNodeReferenceable
|
||||||
func (n *NodePlannableLocal) ReferenceableAddrs() []addrs.Referenceable {
|
func (n *nodeExpandLocal) ReferenceableAddrs() []addrs.Referenceable {
|
||||||
return []addrs.Referenceable{n.Addr}
|
return []addrs.Referenceable{n.Addr}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeReferencer
|
// GraphNodeReferencer
|
||||||
func (n *NodePlannableLocal) References() []*addrs.Reference {
|
func (n *nodeExpandLocal) References() []*addrs.Reference {
|
||||||
refs, _ := lang.ReferencesInExpr(n.Config.Expr)
|
refs, _ := lang.ReferencesInExpr(n.Config.Expr)
|
||||||
return appendResourceDestroyReferences(refs)
|
return appendResourceDestroyReferences(refs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NodePlannableLocal) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
func (n *nodeExpandLocal) 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) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (t *LocalTransformer) transformModule(g *Graph, c *configs.Config) error {
|
||||||
|
|
||||||
for _, local := range c.Module.Locals {
|
for _, local := range c.Module.Locals {
|
||||||
addr := addrs.LocalValue{Name: local.Name}
|
addr := addrs.LocalValue{Name: local.Name}
|
||||||
node := &NodePlannableLocal{
|
node := &nodeExpandLocal{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
Module: c.Path,
|
Module: c.Path,
|
||||||
Config: local,
|
Config: local,
|
||||||
|
|
Loading…
Reference in New Issue