terraform-bundle: return an error if "versions" argument is omitted (#28158)

This commit is contained in:
Kristin Laemmert 2021-03-22 10:51:03 -04:00 committed by GitHub
parent 683422e54f
commit 125e9d69d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -72,11 +72,15 @@ func (c *Config) validate() error {
return fmt.Errorf("providers.%s: %s", k, diags.Err().Error())
}
}
if len(cs.Versions) > 0 {
for _, c := range cs.Versions {
if _, err := getproviders.ParseVersionConstraints(c); err != nil {
return fmt.Errorf("providers.%s: %s", k, err)
}
}
} else {
return fmt.Errorf("provider.%s: required \"versions\" argument not found", k)
}
}
return nil