func()

in astro/conf/module.go [55:79]


func (m *Module) Validate() (errs error) {
	if m.Path == "" {
		errs = multierror.Append(errs, errors.New("path cannot be empty"))
	} else {
		fullModulePath := filepath.Join(m.TerraformCodeRoot, m.Path)

		if !utils.IsWithinPath(m.TerraformCodeRoot, fullModulePath) {
			errs = multierror.Append(errs, fmt.Errorf("module path cannot be outside code root: module path: %v; code root: %v", fullModulePath, m.TerraformCodeRoot))
		}

		if !utils.IsDirectory(fullModulePath) {
			errs = multierror.Append(errs, fmt.Errorf("module directory does not exist: %v", fullModulePath))
		}
	}
	if err := m.Terraform.Validate(); err != nil {
		errs = multierror.Append(errs, fmt.Errorf("Terraform: %v", err))
	}
	for _, hook := range m.Hooks.PreModuleRun {
		if err := hook.Validate(); err != nil {
			errs = multierror.Append(errs, fmt.Errorf("PreModuleRun Hook: %v", err))
		}
	}

	return errs
}