Skip to content

Commit ad03a21

Browse files
committed
terraform: rename to ModuleVariable
1 parent 4dfdc52 commit ad03a21

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

terraform/graph_builder_apply.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer {
6464
&ProvisionerTransformer{},
6565

6666
// Add module variables
67-
&VariableTransformer{Module: b.Module},
67+
&ModuleVariableTransformer{Module: b.Module},
6868

6969
// Add the outputs
7070
&OutputTransformer{Module: b.Module},
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ import (
77
"github.com/hashicorp/terraform/config/module"
88
)
99

10-
// NodeApplyableVariable represents a variable during the apply step.
11-
type NodeApplyableVariable struct {
10+
// NodeApplyableModuleVariable represents a module variable input during
11+
// the apply step.
12+
type NodeApplyableModuleVariable struct {
1213
PathValue []string
1314
Config *config.Variable // Config is the var in the config
1415
Value *config.RawConfig // Value is the value that is set
1516

1617
Module *module.Tree // Antiquated, want to remove
1718
}
1819

19-
func (n *NodeApplyableVariable) Name() string {
20+
func (n *NodeApplyableModuleVariable) Name() string {
2021
result := fmt.Sprintf("var.%s", n.Config.Name)
2122
if len(n.PathValue) > 1 {
2223
result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result)
@@ -26,7 +27,7 @@ func (n *NodeApplyableVariable) Name() string {
2627
}
2728

2829
// GraphNodeSubPath
29-
func (n *NodeApplyableVariable) Path() []string {
30+
func (n *NodeApplyableModuleVariable) Path() []string {
3031
// We execute in the parent scope (above our own module) so that
3132
// we can access the proper interpolations.
3233
if len(n.PathValue) > 2 {
@@ -37,20 +38,20 @@ func (n *NodeApplyableVariable) Path() []string {
3738
}
3839

3940
// GraphNodeReferenceGlobal
40-
func (n *NodeApplyableVariable) ReferenceGlobal() bool {
41+
func (n *NodeApplyableModuleVariable) ReferenceGlobal() bool {
4142
// We have to create fully qualified references because we cross
4243
// boundaries here: our ReferenceableName is in one path and our
4344
// References are from another path.
4445
return true
4546
}
4647

4748
// GraphNodeReferenceable
48-
func (n *NodeApplyableVariable) ReferenceableName() []string {
49+
func (n *NodeApplyableModuleVariable) ReferenceableName() []string {
4950
return []string{n.Name()}
5051
}
5152

5253
// GraphNodeEvalable
53-
func (n *NodeApplyableVariable) EvalTree() EvalNode {
54+
func (n *NodeApplyableModuleVariable) EvalTree() EvalNode {
5455
// If we have no value, do nothing
5556
if n.Value == nil {
5657
return &EvalNoop{}

terraform/transform_variable.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ import (
88
"github.com/hashicorp/terraform/dag"
99
)
1010

11-
// VariableTransformer is a GraphTransformer that adds all the variables
11+
// ModuleVariableTransformer is a GraphTransformer that adds all the variables
1212
// in the configuration to the graph.
1313
//
1414
// This only adds variables that either have no dependencies (and therefore
1515
// always succeed) or has dependencies that are 100% represented in the
1616
// graph.
17-
type VariableTransformer struct {
17+
type ModuleVariableTransformer struct {
1818
Module *module.Tree
1919
}
2020

21-
func (t *VariableTransformer) Transform(g *Graph) error {
21+
func (t *ModuleVariableTransformer) Transform(g *Graph) error {
2222
return t.transform(g, nil, t.Module)
2323
}
2424

25-
func (t *VariableTransformer) transform(g *Graph, parent, m *module.Tree) error {
25+
func (t *ModuleVariableTransformer) transform(g *Graph, parent, m *module.Tree) error {
2626
// If no config, no variables
2727
if m == nil {
2828
return nil
@@ -85,7 +85,7 @@ func (t *VariableTransformer) transform(g *Graph, parent, m *module.Tree) error
8585
// NOTE: For now this is just an "applyable" variable. As we build
8686
// new graph builders for the other operations I suspect we'll
8787
// find a way to parameterize this, require new transforms, etc.
88-
node := &NodeApplyableVariable{
88+
node := &NodeApplyableModuleVariable{
8989
PathValue: normalizeModulePath(m.Path()),
9090
Config: v,
9191
Value: value,

0 commit comments

Comments
 (0)