A practitioner is migrating a working directory from local state to HCP Terraform (formerly Terraform Cloud) so runs execute remotely and state is managed centrally. They add the block shown to their configuration. After running terraform init and authenticating, what does this configuration cause to happen on the next terraform apply?
terraform {
cloud {
organization = "acme-corp"
workspaces {
name = "networking-prod"
}
}
}- AThe apply runs on the practitioner's machine while HCP Terraform only stores the resulting state file after the run completes.
- BThe plan and apply are executed remotely by HCP Terraform in the networking-prod workspace, and state is stored and managed there rather than on the local disk. Correct
- CThe configuration fails to initialise because a cloud block also requires a nested backend block naming the state storage backend.
- DTerraform provisions a new workspace on every apply and discards the previous run's state, keeping only the latest execution.
Why A is wrong: This describes a state-only remote backend, but the cloud block's default remote execution mode runs the plan and apply on HCP Terraform, not locally.
Why B is correct: The cloud block binds the working directory to the named HCP Terraform workspace, so by default runs execute remotely and state is held in that workspace.
Why C is wrong: It is tempting to assume state needs a backend block, but the cloud block replaces backend configuration entirely and the two cannot be combined.
Why D is wrong: HCP Terraform persists a versioned state history in the workspace; it does not discard prior state, and the workspace is reused rather than recreated each run.