backend/remote: compare versions without the prerelease

This commit is contained in:
Sander van Harmelen 2018-12-19 17:28:32 +01:00
parent 65c0826293
commit 7b51af72b2
2 changed files with 3 additions and 3 deletions

View File

@ -370,7 +370,7 @@ func (b *Remote) checkConstraints(c *disco.Constraints) tfdiags.Diagnostics {
}
// Create the version to check.
v, err := version.NewVersion(tfversion.String())
v, err := version.NewVersion(tfversion.Version)
if err != nil {
return diags.Append(checkConstraintsWarning(err))
}
@ -433,7 +433,7 @@ func (b *Remote) checkConstraints(c *disco.Constraints) tfdiags.Diagnostics {
summary := fmt.Sprintf("Incompatible Terraform version v%s", v.String())
details := fmt.Sprintf(
"The configured Terraform Enterprise backend is compatible with Terraform "+
"versions >= %s, < %s%s.", c.Minimum, c.Maximum, excluding,
"versions >= %s, <= %s%s.", c.Minimum, c.Maximum, excluding,
)
if action != "" && toVersion != "" {

View File

@ -379,7 +379,7 @@ func TestRemote_checkConstraints(t *testing.T) {
Maximum: "0.11.11",
},
version: "0.10.1",
result: "versions >= 0.11.0, < 0.11.11.",
result: "versions >= 0.11.0, <= 0.11.11.",
},
"list exclusion": {
constraints: &disco.Constraints{