002 · Domain 7: HCP Terraform / Enterprise Operations · 12% of the exam
Task 7.4: Upgrade Terraform versions across workspaces
Moving many HCP Terraform workspaces to a new Terraform version: the workspace version setting, required_version, speculative plans to check, and state that newer versions write.
Study it
Upgrading Terraform versions across workspaces
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the HashiCorp documentation page that proves it.
Question 1 · choose 1
A team tests Terraform 1.15 for a workspace with a speculative plan, switches the workspace's Terraform version in its settings, and merges the matching required_version change. The run that follows reports no changes and does not ask to apply, and the stored state still shows the old Terraform version. What completes the upgrade?
APull the state with terraform state pull and push it back with the newer CLI
BRoll the workspace back to the previous state version and apply a normal run
CStart a new run with the Allow empty apply run type and apply it
DRun another speculative plan with the new version selected
Show the answer and why
APull the state with terraform state pull and push it back with the newer CLI
Incorrect
Manual state manipulation is not needed and risks overwriting newer data; HCP Terraform provides a run type for this.
BRoll the workspace back to the previous state version and apply a normal run
Incorrect
A rollback restores an older state version; it does not upgrade the state to the new version.
CStart a new run with the Allow empty apply run type and apply it
Correct
An empty apply lets Terraform apply a plan without infrastructure changes, upgrading the state file version during the apply.
DRun another speculative plan with the new version selected
Incorrect
Speculative plans test compatibility but can never be applied, so they cannot write the upgraded state.
Upgrade a workspace in three steps: test with a speculative plan on the new version, change the workspace's Terraform version, then use an empty apply so the state is written by the new version.
A platform team wants fifty workspaces to pick up new 1.15 patch releases without editing each one every time. What does the workspace version setting allow?
AA version constraint such as ~> 1.15.0
BOnly an exact version number
COnly the keyword latest
DA link to a binary URL
Show the answer and why
AA version constraint such as ~> 1.15.0
Correct
The setting accepts an exact version or a valid version constraint.
BOnly an exact version number
Incorrect
Constraints are allowed too.
COnly the keyword latest
Incorrect
Exact versions and constraints are accepted.
DA link to a binary URL
Incorrect
Versions come from the releases HCP Terraform offers.
Pair the workspace constraint with a matching required_version in the configuration.