]>
Commit | Line | Data |
---|---|---|
bae9f6d2 JC |
1 | package terraform |
2 | ||
3 | import ( | |
4 | "fmt" | |
5 | ||
107c1cdb | 6 | "github.com/hashicorp/terraform/addrs" |
bae9f6d2 JC |
7 | "github.com/hashicorp/terraform/config" |
8 | ) | |
9 | ||
10 | // NodeProvisioner represents a provider that has no associated operations. | |
11 | // It registers all the common interfaces across operations for providers. | |
12 | type NodeProvisioner struct { | |
13 | NameValue string | |
107c1cdb | 14 | PathValue addrs.ModuleInstance |
bae9f6d2 JC |
15 | |
16 | // The fields below will be automatically set using the Attach | |
17 | // interfaces if you're running those transforms, but also be explicitly | |
18 | // set if you already have that information. | |
19 | ||
20 | Config *config.ProviderConfig | |
21 | } | |
22 | ||
107c1cdb ND |
23 | var ( |
24 | _ GraphNodeSubPath = (*NodeProvisioner)(nil) | |
25 | _ GraphNodeProvisioner = (*NodeProvisioner)(nil) | |
26 | _ GraphNodeEvalable = (*NodeProvisioner)(nil) | |
27 | ) | |
28 | ||
bae9f6d2 JC |
29 | func (n *NodeProvisioner) Name() string { |
30 | result := fmt.Sprintf("provisioner.%s", n.NameValue) | |
107c1cdb ND |
31 | if len(n.PathValue) > 0 { |
32 | result = fmt.Sprintf("%s.%s", n.PathValue.String(), result) | |
bae9f6d2 JC |
33 | } |
34 | ||
35 | return result | |
36 | } | |
37 | ||
38 | // GraphNodeSubPath | |
107c1cdb | 39 | func (n *NodeProvisioner) Path() addrs.ModuleInstance { |
bae9f6d2 JC |
40 | return n.PathValue |
41 | } | |
42 | ||
43 | // GraphNodeProvisioner | |
44 | func (n *NodeProvisioner) ProvisionerName() string { | |
45 | return n.NameValue | |
46 | } | |
47 | ||
48 | // GraphNodeEvalable impl. | |
49 | func (n *NodeProvisioner) EvalTree() EvalNode { | |
50 | return &EvalInitProvisioner{Name: n.NameValue} | |
51 | } |