]>
Commit | Line | Data |
---|---|---|
bae9f6d2 JC |
1 | package terraform |
2 | ||
3 | import ( | |
107c1cdb ND |
4 | "github.com/hashicorp/terraform/addrs" |
5 | "github.com/hashicorp/terraform/configs" | |
6 | "github.com/hashicorp/terraform/dag" | |
bae9f6d2 JC |
7 | ) |
8 | ||
9 | // NodeRootVariable represents a root variable input. | |
10 | type NodeRootVariable struct { | |
107c1cdb ND |
11 | Addr addrs.InputVariable |
12 | Config *configs.Variable | |
bae9f6d2 JC |
13 | } |
14 | ||
107c1cdb ND |
15 | var ( |
16 | _ GraphNodeSubPath = (*NodeRootVariable)(nil) | |
17 | _ GraphNodeReferenceable = (*NodeRootVariable)(nil) | |
18 | _ dag.GraphNodeDotter = (*NodeApplyableModuleVariable)(nil) | |
19 | ) | |
20 | ||
bae9f6d2 | 21 | func (n *NodeRootVariable) Name() string { |
107c1cdb ND |
22 | return n.Addr.String() |
23 | } | |
24 | ||
25 | // GraphNodeSubPath | |
26 | func (n *NodeRootVariable) Path() addrs.ModuleInstance { | |
27 | return addrs.RootModuleInstance | |
bae9f6d2 JC |
28 | } |
29 | ||
30 | // GraphNodeReferenceable | |
107c1cdb ND |
31 | func (n *NodeRootVariable) ReferenceableAddrs() []addrs.Referenceable { |
32 | return []addrs.Referenceable{n.Addr} | |
33 | } | |
34 | ||
35 | // dag.GraphNodeDotter impl. | |
36 | func (n *NodeRootVariable) DotNode(name string, opts *dag.DotOpts) *dag.DotNode { | |
37 | return &dag.DotNode{ | |
38 | Name: name, | |
39 | Attrs: map[string]string{ | |
40 | "label": n.Name(), | |
41 | "shape": "note", | |
42 | }, | |
43 | } | |
bae9f6d2 | 44 | } |