terraform: don't crash if validating orphan
This commit is contained in:
parent
bbdb375612
commit
6e7d23d612
|
@ -1053,14 +1053,16 @@ func (c *walkContext) validateWalkFn() depgraph.WalkFunc {
|
|||
|
||||
// If the resouce name doesn't match the name regular
|
||||
// expression, show a warning.
|
||||
if !config.NameRegexp.Match([]byte(rn.Config.Name)) {
|
||||
l.Lock()
|
||||
meta.Warns = append(meta.Warns, fmt.Sprintf(
|
||||
"%s: module name can only contain letters, numbers, "+
|
||||
"dashes, and underscores.\n"+
|
||||
"This will be an error in Terraform 0.4",
|
||||
rn.Resource.Id))
|
||||
l.Unlock()
|
||||
if rn.Config != nil {
|
||||
if !config.NameRegexp.Match([]byte(rn.Config.Name)) {
|
||||
l.Lock()
|
||||
meta.Warns = append(meta.Warns, fmt.Sprintf(
|
||||
"%s: module name can only contain letters, numbers, "+
|
||||
"dashes, and underscores.\n"+
|
||||
"This will be an error in Terraform 0.4",
|
||||
rn.Resource.Id))
|
||||
l.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("[INFO] Validating resource: %s", rn.Resource.Id)
|
||||
|
|
Loading…
Reference in New Issue