Skip to content

Commit

Permalink
terraform-bundle: return an error if "versions" argument is omitted (h…
Browse files Browse the repository at this point in the history
  • Loading branch information
mildwonkey authored Mar 22, 2021
1 parent 683422e commit 125e9d6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/terraform-bundle/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ func (c *Config) validate() error {
return fmt.Errorf("providers.%s: %s", k, diags.Err().Error())
}
}
for _, c := range cs.Versions {
if _, err := getproviders.ParseVersionConstraints(c); err != nil {
return fmt.Errorf("providers.%s: %s", k, err)
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)
}
}

Expand Down

0 comments on commit 125e9d6

Please sign in to comment.