mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
b43daeaa8d
The cloud backend (and remote before it) previously expected a TFC workspace's `terraform-version` attribute to be either the magic string `"latest"` or an explicit semver value. But a workspace might have a version constraint instead (like `~> 1.1.0`), in which case the version check would blow up. This commit checks whether `terraform-version` is a valid version constraint before erroring out, and if so, returns success if the local version meets the constraint. Because it's not practical to deeply introspect the slice of version space defined by a constraint, this check is slightly less robust than the version comparisons below it: - It can give a false OK on open-ended constraints like `>= 1.1.0`. Say you're running 1.3.0, it changed the state format, and the TFE instance admin has not yet added any 1.3.x Terraform versions; your workspace will now break. - It will give a false not-OK when using different minor versions within a range that we know to be compatible, e.g. remote constraint of `~> 0.15.0` and local version of 1.1.0. - This would be totally useless with the pre-0.14 versions of Terraform, where patch releases could change state format... but we're not going back in time to add this feature to them anyway. Still, in the most common likely case (`~> x.y.z`), it'll complain at you (with an error you can choose to override) if you're not using the same minor version, and that seems proportionate, useful, and expected. |
||
---|---|---|
.. | ||
e2e | ||
testdata | ||
backend_apply_test.go | ||
backend_apply.go | ||
backend_cli.go | ||
backend_colorize.go | ||
backend_common.go | ||
backend_context_test.go | ||
backend_context.go | ||
backend_plan_test.go | ||
backend_plan.go | ||
backend_refresh_test.go | ||
backend_state_test.go | ||
backend_state.go | ||
backend_test.go | ||
backend.go | ||
cloud_variables_test.go | ||
cloud_variables.go | ||
errors.go | ||
remote_test.go | ||
testing.go | ||
tfe_client_mock.go | ||
versioning.go |