A configuration declares required_version = "~> 1.15.0". Its HCP Terraform workspace is still set to Terraform 1.14.3, and every run now fails during initialization with an unsupported Terraform version error. What is the correct fix?
Select an answer to reveal the explanation.
Short Explanation
Your config demands 1.15, and your workspace keeps showing up with 1.14. Make the workspace's version satisfy the constraint, and the mismatch goes away. Deleting lock files is fixing the wrong lock.
Full Explanation
The required_version setting in the terraform block declares which Terraform versions may run a configuration; ~> 1.15.0 allows 1.15 patch releases only. HCP Terraform runs each workspace with its configured Terraform version, so a workspace set to 1.14.3 fails as soon as Terraform reads a configuration it is not allowed to run. Aligning the two by setting the workspace version to a 1.15 release that satisfies the constraint fixes the runs, and doing so after a speculative plan confirms the change is safe. The dependency lock file pins provider versions and checksums, not the Terraform binary, so deleting it does not affect the version check and loses provider pinning. terraform init -upgrade upgrades providers and modules within their constraints on the machine where it runs; it does not change the workspace's version setting, which is what remote runs use. The cloud block configures the connection to HCP Terraform, including organization and workspaces; required_version belongs in the terraform block and is not read from the cloud block. Exam caveat: the alternative fix of loosening the constraint is only appropriate when the configuration genuinely supports the older release; it should never be changed merely to silence the error. Operational check: after updating the setting, queue a run and confirm the run details show the 1.15 release and initialization completes.