terraform: Validate expands properly

This commit is contained in:
Mitchell Hashimoto 2014-10-02 13:24:38 -07:00
parent 79520a19c4
commit 941e27b9f3
1 changed files with 9 additions and 1 deletions

View File

@ -956,7 +956,8 @@ func (c *walkContext) validateWalkFn() depgraph.WalkFunc {
meta.Children = make(map[string]*walkValidateMeta)
}
return func(n *depgraph.Noun) error {
var walkFn depgraph.WalkFunc
walkFn = func(n *depgraph.Noun) error {
// If it is the root node, ignore
if n.Name == GraphRootNode {
return nil
@ -988,6 +989,11 @@ func (c *walkContext) validateWalkFn() depgraph.WalkFunc {
panic("resource should never be nil")
}
// If we're expanding, then expand the nodes, and then rewalk the graph
if rn.ExpandMode > ResourceExpandNone {
return c.genericWalkResource(rn, walkFn)
}
// If it doesn't have a provider, that is a different problem
if rn.Resource.Provider == nil {
return nil
@ -1060,6 +1066,8 @@ func (c *walkContext) validateWalkFn() depgraph.WalkFunc {
return nil
}
return walkFn
}
func (c *walkContext) genericWalkFn(cb genericWalkFunc) depgraph.WalkFunc {