|
|
|
|
@ -220,6 +220,7 @@ func (c *Config) Validate() error {
|
|
|
|
|
modules := make(map[string]*Module)
|
|
|
|
|
dupped := make(map[string]struct{})
|
|
|
|
|
for _, m := range c.Modules {
|
|
|
|
|
// Check for duplicates
|
|
|
|
|
if _, ok := modules[m.Id()]; ok {
|
|
|
|
|
if _, ok := dupped[m.Id()]; !ok {
|
|
|
|
|
dupped[m.Id()] = struct{}{}
|
|
|
|
|
@ -230,6 +231,23 @@ func (c *Config) Validate() error {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we haven't seen this module before, check that the
|
|
|
|
|
// source has no interpolations.
|
|
|
|
|
if _, ok := modules[m.Id()]; !ok {
|
|
|
|
|
rc, err := NewRawConfig(map[string]interface{}{
|
|
|
|
|
"root": m.Source,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
errs = append(errs, fmt.Errorf(
|
|
|
|
|
"%s: module source error: %s",
|
|
|
|
|
m.Id(), err))
|
|
|
|
|
} else if len(rc.Interpolations) > 0 {
|
|
|
|
|
errs = append(errs, fmt.Errorf(
|
|
|
|
|
"%s: module source cannot contain interpolations",
|
|
|
|
|
m.Id()))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
modules[m.Id()] = m
|
|
|
|
|
}
|
|
|
|
|
dupped = nil
|
|
|
|
|
|