nerdexam
HashiCorp

TA-002-P · Question #190

Which of the below features of Terraform can be used for managing small differences between different environments which can act more like completely separate working directories.

The correct answer is B. Workspaces. Terraform Workspaces allow you to maintain multiple independent state files within the same configuration directory. Each workspace has its own state, so you can deploy the same configuration to dev, staging, and prod environments while keeping their states isolated - similar…

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

Question

Which of the below features of Terraform can be used for managing small differences between different environments which can act more like completely separate working directories.

Options

  • ARepositories
  • BWorkspaces
  • CEnvironment Variables
  • DBackends

How the community answered

(28 responses)
  • A
    4% (1)
  • B
    86% (24)
  • C
    7% (2)
  • D
    4% (1)

Explanation

Terraform Workspaces allow you to maintain multiple independent state files within the same configuration directory. Each workspace has its own state, so you can deploy the same configuration to dev, staging, and prod environments while keeping their states isolated - similar to having separate working directories. Backends (D) handle where/how state is stored, not environment separation. Environment Variables (C) can set values but do not isolate state. Repositories (A) are a code management concept, not a Terraform feature for this purpose. For complex environment differences, the Terraform community often recommends separate directories or root modules, but for small differences, workspaces are the built-in mechanism.

Topics

#Terraform Workspaces#Multi-environment#State isolation

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice