mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 18:01:01 -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. |
||
---|---|---|
.. | ||
addrs | ||
backend | ||
builtin | ||
cloud | ||
command | ||
communicator | ||
configs | ||
copy | ||
dag | ||
depsfile | ||
didyoumean | ||
e2e | ||
earlyconfig | ||
experiments | ||
getmodules | ||
getproviders | ||
grpcwrap | ||
helper | ||
httpclient | ||
initwd | ||
instances | ||
ipaddr | ||
lang | ||
legacy | ||
logging | ||
modsdir | ||
moduledeps | ||
moduletest | ||
plans | ||
plugin | ||
plugin6 | ||
provider-simple | ||
provider-simple-v6 | ||
provider-terraform/main | ||
providercache | ||
providers | ||
provisioner-local-exec/main | ||
provisioners | ||
refactoring | ||
registry | ||
repl | ||
replacefile | ||
states | ||
terminal | ||
terraform | ||
tfdiags | ||
tfplugin5 | ||
tfplugin6 | ||
typeexpr |