backend/remote: compare versions without the prerelease
This commit is contained in:
parent
65c0826293
commit
7b51af72b2
|
@ -370,7 +370,7 @@ func (b *Remote) checkConstraints(c *disco.Constraints) tfdiags.Diagnostics {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the version to check.
|
// Create the version to check.
|
||||||
v, err := version.NewVersion(tfversion.String())
|
v, err := version.NewVersion(tfversion.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diags.Append(checkConstraintsWarning(err))
|
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())
|
summary := fmt.Sprintf("Incompatible Terraform version v%s", v.String())
|
||||||
details := fmt.Sprintf(
|
details := fmt.Sprintf(
|
||||||
"The configured Terraform Enterprise backend is compatible with Terraform "+
|
"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 != "" {
|
if action != "" && toVersion != "" {
|
||||||
|
|
|
@ -379,7 +379,7 @@ func TestRemote_checkConstraints(t *testing.T) {
|
||||||
Maximum: "0.11.11",
|
Maximum: "0.11.11",
|
||||||
},
|
},
|
||||||
version: "0.10.1",
|
version: "0.10.1",
|
||||||
result: "versions >= 0.11.0, < 0.11.11.",
|
result: "versions >= 0.11.0, <= 0.11.11.",
|
||||||
},
|
},
|
||||||
"list exclusion": {
|
"list exclusion": {
|
||||||
constraints: &disco.Constraints{
|
constraints: &disco.Constraints{
|
||||||
|
|
Loading…
Reference in New Issue