A team uses the CLI-driven workflow with HCP Terraform. Their workspaces app-dev, app-staging and app-prod all carry the tag app. Developers want one configuration that lets them switch among those workspaces with terraform workspace select. How should the configuration connect?
Select an answer to reveal the explanation.
Short Explanation
Tags in the cloud block are like a playlist filter: show me every workspace tagged app, then pick the one you want to play. A name pins you to exactly one track. The trap is expecting name to understand wildcards; it doesn't.
Full Explanation
The cloud block connects a CLI-driven configuration to HCP Terraform, and its workspaces block decides which workspaces the configuration maps to. Setting tags, either as a list of key-only tags or as a map of key-value tags, associates the configuration with every workspace that carries those tags; terraform workspace list then shows them and terraform workspace select switches among them, and new workspaces created this way receive the tags. Setting name associates the configuration with exactly one workspace and does not accept wildcard patterns, so app-* would be treated as a literal workspace name. name and tags are mutually exclusive in the workspaces block, so a configuration that sets both is invalid. A configuration can contain only one cloud block, so three blocks for three environments are not allowed. Exam caveat: the cloud block cannot reference variables, but the TF_WORKSPACE environment variable can select a workspace non-interactively in automation, and settings such as organization can come from environment variables when omitted. Operational check: run terraform init, then terraform workspace list to confirm the three tagged workspaces appear, and select one before planning.