TF-004 Use Terraform outside the core workflow Practice Question
Which THREE are valid methods to create and manage Terraform workspaces?
⚠ Common exam trap
The Terraform exam often tests the distinction between Terraform's native workspace commands and external tools like version control or cloud provider tags, trapping candidates who confuse code management with state management.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Using 'terraform workspace' commands (new, select, delete)
Option C is correct because the Terraform CLI provides the native 'terraform workspace' subcommands — 'terraform workspace new', 'terraform workspace select', and 'terraform workspace delete' — which create, switch between, and remove workspaces within a working directory, storing state per workspace. Option D is correct because Terraform Cloud exposes a REST API that lets you programmatically create, list, and delete workspaces (e.g., via the /organizations/:organization_name/workspaces endpoints), enabling automation and CI/CD integration. Option E is correct because the Terraform Cloud web UI allows users to create and manage workspaces through the graphical interface, including setting variables, VCS connections, and team access. Option A is not a valid Terraform mechanism: version control branches are a general Git practice and are not tied to Terraform workspace state management. Option B is not valid either: AWS tags are metadata applied to cloud resources and have no role in creating or managing Terraform workspaces.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Using version control branches
Why it's wrong here
Version control branches, while integral to collaborative development and triggering Terraform runs in CI/CD pipelines or Terraform Cloud, are not a direct mechanism for creating or managing Terraform workspaces themselves. A branch typically points to a specific configuration version that a pre-existing workspace will then execute. They facilitate code management and execution flow, but not the lifecycle management of the workspace entity, which is handled by Terraform's internal mechanisms.
- ✗
Using tags in AWS
Why it's wrong here
AWS tags are metadata labels applied to AWS resources for organization, cost allocation, and access control within the Amazon Web Services ecosystem. They serve to categorize and identify cloud infrastructure components. However, AWS tags have no functional relationship whatsoever with the creation, selection, or deletion of Terraform workspaces, which are an internal construct of Terraform's state management and execution environment, independent of cloud provider-specific tagging systems.
- ✓
Using 'terraform workspace' commands (new, select, delete)
Why this is correct
The `terraform workspace` CLI commands provide direct, granular control over local and remote Terraform workspaces. Specifically, `terraform workspace new <name>` creates a new workspace, `terraform workspace select <name>` switches the current working context to an existing one, and `terraform workspace delete <name>` removes a workspace. These commands are fundamental for isolating different environments or stages of infrastructure within a single Terraform configuration, managing their respective state files.
- ✓
Using the Terraform Cloud API
Why this is correct
The Terraform Cloud API offers a comprehensive set of RESTful endpoints that allow for programmatic interaction with and management of Terraform Cloud resources, including workspaces. Developers and automation engineers can leverage this API to create, update, delete, and retrieve details about workspaces, integrating Terraform Cloud operations into custom scripts, CI/CD pipelines, or other management tools. This method provides powerful automation capabilities beyond manual interaction.
- ✓
Using the Terraform Cloud web UI
Why this is correct
The Terraform Cloud web user interface provides an intuitive, graphical environment for managing all aspects of Terraform Cloud, including the creation and administration of workspaces. Users can navigate to their organization, select a project, and then visually create new workspaces, configure their settings, view their runs, and manage their state files directly through the browser. This method is ideal for manual interaction and visual oversight of infrastructure deployments.
Go deeper
Related to this question
About these practice questions
This TF-004 question is part of Courseiva's 434-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This TF-004 practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the TF-004 exam.