A practitioner wants to move an existing project from a local backend to HCP Terraform for remote state and remote runs. Which configuration block belongs inside the terraform block to connect the working directory to an HCP Terraform workspace?
terraform {
# which block goes here?
}- AA backend "remote" block pointing at app.terraform.io, since that is the only supported way to reach HCP Terraform.
- BA backend "cloud" block, because every remote integration is declared as a named backend.
- CA cloud block naming the organisation and the workspace to use in HCP Terraform. Correct
- DA provider "tfe" block configured with the organisation token and workspace name.
Why A is wrong: Tempting because the remote backend was the older approach and still works, but it is no longer the recommended way; the cloud block is the current integration.
Why B is wrong: Plausible by analogy with backend "s3", but there is no backend named cloud; HCP Terraform uses a top-level cloud block, not a backend block.
Why C is correct: Correct: HCP Terraform is configured with the cloud block, which names the organisation and workspace and enables remote state and runs after init.
Why D is wrong: This confuses managing HCP Terraform resources with connecting to it; the tfe provider manages settings via the API but does not wire state to a workspace.