]>
Commit | Line | Data |
---|---|---|
bae9f6d2 JC |
1 | package terraform |
2 | ||
3 | import ( | |
4 | "github.com/hashicorp/terraform/dag" | |
5 | ) | |
6 | ||
7 | // ValidateGraphBuilder creates the graph for the validate operation. | |
8 | // | |
9 | // ValidateGraphBuilder is based on the PlanGraphBuilder. We do this so that | |
10 | // we only have to validate what we'd normally plan anyways. The | |
11 | // PlanGraphBuilder given will be modified so it shouldn't be used for anything | |
12 | // else after calling this function. | |
13 | func ValidateGraphBuilder(p *PlanGraphBuilder) GraphBuilder { | |
14 | // We're going to customize the concrete functions | |
15 | p.CustomConcrete = true | |
16 | ||
17 | // Set the provider to the normal provider. This will ask for input. | |
18 | p.ConcreteProvider = func(a *NodeAbstractProvider) dag.Vertex { | |
19 | return &NodeApplyableProvider{ | |
20 | NodeAbstractProvider: a, | |
21 | } | |
22 | } | |
23 | ||
24 | p.ConcreteResource = func(a *NodeAbstractResource) dag.Vertex { | |
25 | return &NodeValidatableResource{ | |
107c1cdb | 26 | NodeAbstractResource: a, |
bae9f6d2 JC |
27 | } |
28 | } | |
29 | ||
30 | // We purposely don't set any other concrete types since they don't | |
31 | // require validation. | |
32 | ||
33 | return p | |
34 | } |