github.com/skyscape-cloud-services/terraform@v0.9.2-0.20170609144644-7ece028a1747/terraform/graph_builder_validate.go (about) 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{ 26 NodeAbstractCountResource: &NodeAbstractCountResource{ 27 NodeAbstractResource: a, 28 }, 29 } 30 } 31 32 // We purposely don't set any other concrete types since they don't 33 // require validation. 34 35 return p 36 }