github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/not-internal/terraform/graph_builder_validate.go (about) 1 package terraform 2 3 import ( 4 "github.com/muratcelep/terraform/not-internal/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{ 26 NodeAbstractResource: a, 27 } 28 } 29 30 p.ConcreteModule = func(n *nodeExpandModule) dag.Vertex { 31 return &nodeValidateModule{ 32 nodeExpandModule: *n, 33 } 34 } 35 36 // We purposely don't set any other concrete types since they don't 37 // require validation. 38 39 return p 40 }