cloud: Support interop from 0.14 to 1.1

The previous conservative guarantee that we would not make backwards
incompatible changes to the state file format until at least Terraform
1.1 can now be extended. Terraform 0.14 through 1.1 will be able to
interoperably use state files, so we can update the remote backend
version compatibility check accordingly.

This is a port of https://github.com/hashicorp/terraform/pull/29645
This commit is contained in:
Chris Arcand 2021-09-24 09:03:12 -05:00
parent 74e087dc29
commit aba7d96596
2 changed files with 5 additions and 4 deletions

View File

@ -940,9 +940,9 @@ func (b *Cloud) VerifyWorkspaceTerraformVersion(workspaceName string) tfdiags.Di
// are aware of are: // are aware of are:
// //
// - 0.14.0 is guaranteed to be compatible with versions up to but not // - 0.14.0 is guaranteed to be compatible with versions up to but not
// including 1.1.0 // including 1.2.0
v110 := version.Must(version.NewSemver("1.1.0")) v120 := version.Must(version.NewSemver("1.2.0"))
if tfversion.SemVer.LessThan(v110) && remoteVersion.LessThan(v110) { if tfversion.SemVer.LessThan(v120) && remoteVersion.LessThan(v120) {
return diags return diags
} }
// - Any new Terraform state version will require at least minor patch // - Any new Terraform state version will require at least minor patch

View File

@ -896,7 +896,8 @@ func TestCloud_VerifyWorkspaceTerraformVersion(t *testing.T) {
{"0.14.0", "0.13.5", false, false}, {"0.14.0", "0.13.5", false, false},
{"0.14.0", "0.14.1", true, false}, {"0.14.0", "0.14.1", true, false},
{"0.14.0", "1.0.99", true, false}, {"0.14.0", "1.0.99", true, false},
{"0.14.0", "1.1.0", true, true}, {"0.14.0", "1.1.0", true, false},
{"0.14.0", "1.2.0", true, true},
{"1.2.0", "1.2.99", true, false}, {"1.2.0", "1.2.99", true, false},
{"1.2.0", "1.3.0", true, true}, {"1.2.0", "1.3.0", true, true},
{"0.15.0", "latest", true, false}, {"0.15.0", "latest", true, false},