]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/github.com/hashicorp/terraform/terraform/node_local.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / terraform / node_local.go
CommitLineData
15c0b25d
AP
1package terraform
2
3import (
107c1cdb
ND
4 "github.com/hashicorp/terraform/addrs"
5 "github.com/hashicorp/terraform/configs"
6 "github.com/hashicorp/terraform/dag"
7 "github.com/hashicorp/terraform/lang"
15c0b25d
AP
8)
9
10// NodeLocal represents a named local value in a particular module.
11//
12// Local value nodes only have one operation, common to all walk types:
13// evaluate the result and place it in state.
14type NodeLocal struct {
107c1cdb
ND
15 Addr addrs.AbsLocalValue
16 Config *configs.Local
15c0b25d
AP
17}
18
107c1cdb
ND
19var (
20 _ GraphNodeSubPath = (*NodeLocal)(nil)
21 _ RemovableIfNotTargeted = (*NodeLocal)(nil)
22 _ GraphNodeReferenceable = (*NodeLocal)(nil)
23 _ GraphNodeReferencer = (*NodeLocal)(nil)
24 _ GraphNodeEvalable = (*NodeLocal)(nil)
25 _ dag.GraphNodeDotter = (*NodeLocal)(nil)
26)
15c0b25d 27
107c1cdb
ND
28func (n *NodeLocal) Name() string {
29 return n.Addr.String()
15c0b25d
AP
30}
31
32// GraphNodeSubPath
107c1cdb
ND
33func (n *NodeLocal) Path() addrs.ModuleInstance {
34 return n.Addr.Module
15c0b25d
AP
35}
36
37// RemovableIfNotTargeted
38func (n *NodeLocal) RemoveIfNotTargeted() bool {
39 return true
40}
41
42// GraphNodeReferenceable
107c1cdb
ND
43func (n *NodeLocal) ReferenceableAddrs() []addrs.Referenceable {
44 return []addrs.Referenceable{n.Addr.LocalValue}
15c0b25d
AP
45}
46
47// GraphNodeReferencer
107c1cdb
ND
48func (n *NodeLocal) References() []*addrs.Reference {
49 refs, _ := lang.ReferencesInExpr(n.Config.Expr)
50 return appendResourceDestroyReferences(refs)
15c0b25d
AP
51}
52
53// GraphNodeEvalable
54func (n *NodeLocal) EvalTree() EvalNode {
55 return &EvalLocal{
107c1cdb
ND
56 Addr: n.Addr.LocalValue,
57 Expr: n.Config.Expr,
58 }
59}
60
61// dag.GraphNodeDotter impl.
62func (n *NodeLocal) DotNode(name string, opts *dag.DotOpts) *dag.DotNode {
63 return &dag.DotNode{
64 Name: name,
65 Attrs: map[string]string{
66 "label": n.Name(),
67 "shape": "note",
68 },
15c0b25d
AP
69 }
70}