terraform: don't crash if validating orphan

This commit is contained in:
Mitchell Hashimoto 2014-10-11 15:58:52 -07:00
parent bbdb375612
commit 6e7d23d612
1 changed files with 10 additions and 8 deletions

View File

@ -1053,6 +1053,7 @@ func (c *walkContext) validateWalkFn() depgraph.WalkFunc {
// If the resouce name doesn't match the name regular // If the resouce name doesn't match the name regular
// expression, show a warning. // expression, show a warning.
if rn.Config != nil {
if !config.NameRegexp.Match([]byte(rn.Config.Name)) { if !config.NameRegexp.Match([]byte(rn.Config.Name)) {
l.Lock() l.Lock()
meta.Warns = append(meta.Warns, fmt.Sprintf( meta.Warns = append(meta.Warns, fmt.Sprintf(
@ -1062,6 +1063,7 @@ func (c *walkContext) validateWalkFn() depgraph.WalkFunc {
rn.Resource.Id)) rn.Resource.Id))
l.Unlock() l.Unlock()
} }
}
log.Printf("[INFO] Validating resource: %s", rn.Resource.Id) log.Printf("[INFO] Validating resource: %s", rn.Resource.Id)
ws, es := rn.Resource.Provider.ValidateResource( ws, es := rn.Resource.Provider.ValidateResource(