Courseiva
Implement and maintain statemediumMultiple SelectObjective-mapped

TF-004 Implement and maintain state Practice Question

Which TWO of the following are true about Terraform workspaces?

⚠ Common exam trap

HashiCorp often tests the misconception that workspaces can manage different provider configurations or that all workspaces share a single state file, when in fact workspaces only isolate state and have no effect on provider configuration.

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

The default workspace is named 'default'

The default workspace is named 'default'. Option E is correct because each Terraform workspace maintains its own separate state file, allowing state isolation for different environments. Option A is incorrect because workspaces do not manage provider configurations; they only separate state. Option B is false because each workspace has its own state file, not shared. Option C is false because the default workspace cannot be deleted.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Workspaces can be used to manage different provider configurations

    Why it's wrong here

    This statement is incorrect because Terraform workspaces are designed to manage distinct states for a single configuration, not to alter the configuration itself. Provider configurations, including their aliases and authentication details, are defined within the `.tf` files and are static across all workspaces for a given root module. Therefore, you cannot use workspaces to dynamically switch or modify provider settings; those are determined by the written code.

  • All workspaces share the same state file

    Why it's wrong here

    This statement is incorrect because a fundamental purpose of Terraform workspaces is to provide isolated state management for different environments or stages. Each workspace, such as 'default', 'staging', or 'production', maintains its own distinct state file, which tracks the resources managed within that specific environment. This separation prevents resource conflicts and ensures independent infrastructure lifecycle management.

  • The default workspace can be deleted

    Why it's wrong here

    The 'default' workspace is a special, immutable workspace that Terraform initializes automatically when `terraform init` is first run in a new configuration directory. It serves as the initial and fallback environment for all operations. Terraform explicitly prevents users from deleting this 'default' workspace, ensuring there is always a baseline workspace available, even if other custom workspaces are removed.

  • The default workspace is named 'default'

    Why this is correct

    This statement is correct. When Terraform is initialized in a new directory using `terraform init`, it automatically creates a workspace named 'default'. This 'default' workspace is where all operations occur unless a different workspace is explicitly selected using `terraform workspace select <name>`. It serves as the initial and primary working environment for a Terraform configuration.

  • Each workspace has its own state file

    Why this is correct

    This statement is accurate and highlights a core feature of Terraform workspaces. Each workspace, whether it's the initial 'default' or a custom one created with `terraform workspace new`, maintains its own distinct `terraform.tfstate` file. This isolation ensures that infrastructure changes made in one environment, like 'staging', do not inadvertently affect resources managed in another, such as 'production'.

About these practice questions

This TF-004 question is part of Courseiva's 428-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 →

How Courseiva writes practice questions · Editorial policy

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.