TA-002-P · Question #387
colleagues is new toTerraform and wants to add a new workspace named new-hire. What command he should execute from the following?
The correct answer is B. terraform workspace new new hire. To create a new workspace in Terraform, the command terraform workspace new <workspace-name> is the correct syntax.
Question
colleagues is new toTerraform and wants to add a new workspace named new-hire. What command he should execute from the following?
Options
- Aterraform workspace-new-new-hire
- Bterraform workspace new new hire
- Cterraform workspace init new-hire
- Dterraform workspace new-hire
How the community answered
(34 responses)- A3% (1)
- B94% (32)
- D3% (1)
Why each option
To create a new workspace in Terraform, the command `terraform workspace new <workspace-name>` is the correct syntax.
The command syntax terraform workspace-new-new-hire is incorrect; the subcommand new should be separate.
The correct command to create a new workspace named new-hire is terraform workspace new new-hire. This command initializes a new isolated state for the specified workspace name, allowing different environments or configurations to share the same code.
terraform workspace init is not a valid command; terraform init initializes the working directory, but not specifically for creating workspaces.
terraform workspace new-hire is incomplete syntax for creating a new workspace; it's missing the new subcommand.
Concept tested: Terraform workspace creation
Source: https://developer.hashicorp.com/terraform/cli/commands/workspace/new
Topics
Community Discussion
No community discussion yet for this question.