Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 2


One remote backend configuration always maps to a single remote workspace.

Show Answer
Correct Answer: B

The statement that one remote backend configuration always maps to a single remote workspace is false. A remote backend configuration in Terraform can either map to a single remote workspace or to multiple similarly-named remote workspaces. The configuration can use the 'workspaces.name' to specify a single workspace or the 'workspaces.prefix' to map to multiple remote workspaces with a common prefix.

Discussion

41 comments
Sign in to comment
SpandropOption: B
Dec 16, 2023

1 workspace -> 1 backend 1 backend -> multiple workspaces

Zam88Option: B
Jun 19, 2022

correct B

6957dbdOption: B
Mar 10, 2024

The prefix switch is key here: prefix - (Optional) A prefix used in the names of one or more remote workspaces, all of which can be used with this configuration. The full workspace names are used in Terraform Cloud, and the short names (minus the prefix) are used on the command line for Terraform CLI workspaces. If omitted, only the default workspace can be used. This option conflicts with name. To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix = "networking-" to use Terraform cloud workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple Terraform CLI workspaces used in a single Terraform configuration to multiple Terraform Cloud workspaces. The backend configuration requires either name or prefix. Omitting both or setting both results in a configuration error.

ParthasarathiOption: B
May 18, 2022

It should be B

Zam88
Jun 19, 2022

The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses: Correct B

princajenOption: A
Feb 16, 2023

According to the official Terraform documentation: Each backend configuration is associated with exactly one workspace. When configuring the backend, you must specify the name of the workspace to use, and Terraform will store the state data in that workspace. When you run Terraform commands, the state data for the associated workspace is loaded from the remote backend and compared against the configuration to detect drift. Source: Terraform Backends https://www.terraform.io/docs/backends/index.html

TigerInTheCloudOption: B
Dec 19, 2023

https://developer.hashicorp.com/terraform/language/settings/backends/remote "To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix = "networking-" to use Terraform cloud workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple Terraform CLI workspaces used in a single Terraform configuration to multiple Terraform Cloud workspaces."

softarts
May 16, 2022

I take B

bp339
May 20, 2022

It is B

doumx
Jun 1, 2022

B is the correct answer

EltoothOption: A
Jun 30, 2022

Poorly worded question and open to interpretation. "The persistent data stored in the backend belongs to a workspace. Initially the backend has only one workspace, called "default", and thus there is only one Terraform state associated with that configuration. Certain backends support multiple named workspaces, allowing multiple states to be associated with a single configuration. The configuration still has only one backend, but multiple distinct instances of that configuration to be deployed without configuring a new backend or changing authentication credentials. Named workspaces allow conveniently switching between multiple instances of a single configuration within its single backend. They are convenient in a number of situations, but cannot solve all problems. Named workspaces allow conveniently switching between multiple instances of a single configuration within its single backend. They are convenient in a number of situations, but cannot solve all problems." https://www.terraform.io/language/state/workspaces

geekneekOption: B
Aug 16, 2022

The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses: To use a single remote Terraform Cloud workspace, set workspaces.name to the remote workspace's full name (like networking-prod). To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix = "networking-" to use Terraform cloud workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple Terraform CLI workspaces used in a single Terraform configuration to multiple Terraform Cloud workspaces.

BereOption: B
Oct 12, 2022

As described here: https://www.terraform.io/language/settings/backends/remote The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod).

Nunyabiznes
Apr 5, 2023

but it mentions "remote configuration"

adoubanOption: B
Dec 9, 2022

The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses: To use a single remote Terraform Cloud workspace, set workspaces.name to the remote workspace's full name (like networking-prod). To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix = "networking-" to use Terraform cloud workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple Terraform CLI workspaces used in a single Terraform configuration to multiple Terraform Cloud workspaces. https://developer.hashicorp.com/terraform/language/settings/backends/remote

luxdolorosaOption: B
Nov 15, 2023

I am working with GitLab, and I can create multiple instances within a single backend space

BigSteveO
Jun 9, 2022

B has to be correct, It says in the notes that it works with both a single remote workspace and multiple remote workspaces. lol So NO it doesn't only map to a single workspace.

acheiron
Mar 15, 2023

"A" is correct, but the wording of the question is subtle. The keyword is "configuration." A remote backend may have multiple configurations, but each configuration always corresponds to one workspace.

BereOption: B
Jul 27, 2023

1) Example using workspaces.name This example demonstrates the use of a single remote Terraform Cloud workspace by specifying the workspace name. terraform { ... workspaces { name = "networking-prod" } } } In this configuration, all the Terraform commands will be applied to the networking-prod workspace in Terraform Cloud. 2) Example using workspaces.prefix This example demonstrates the use of multiple remote Terraform Cloud workspaces that share a common prefix. terraform { ... workspaces { prefix = "networking-" } } } In this configuration, Terraform commands will apply to any workspace that starts with networking-, such as networking-dev, networking-prod, networking-test, etc. The specific workspace that the commands apply to is determined by the currently selected Terraform CLI workspace. You can switch between workspaces using the terraform workspace select command.

ledjo
Aug 29, 2023

B. A remote backend configuration is used to define where the Terraform state is stored, and it can be shared by multiple workspaces, each of which maintains its own separate state.

esuarveOption: B
Sep 29, 2023

Your explanation actually states that a remote backend can work with multiple similarly-named remote workspaces (like networking-dev and networking-prod) The answer A would not allow this

090200f
Jul 8, 2024

The remote backend can work with either a single remote HCP Terraform workspace, or with multiple similarly-named remote workspaces, so B is correct answer

SIAMIANJIOption: B
Sep 24, 2024

The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses: To use a single remote Terraform Cloud workspace, set workspaces.name to the remote workspace's full name (like networking-prod). To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix = "networking-" to use Terraform cloud workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple Terraform CLI workspaces used in a single Terraform configuration to multiple Terraform Cloud workspaces. https://developer.hashicorp.com/terraform/language/settings/backends/remote

stalosOption: B
Nov 25, 2022

Not always

resnefOption: B
Nov 25, 2022

Bere's comment describes it perfectly

SanchitdevopsOption: B
Dec 14, 2022

B is correct

r1ck
Feb 25, 2023

B : https://developer.hashicorp.com/terraform/language/settings/backends/remote

Musti35Option: B
Apr 16, 2023

Workspaces The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses:

FarziWaliMarziOption: A
Apr 22, 2023

I think that we need to think of configuration here, not backend. So Backend Configuration will always work with one workspace. It cannot point to Dev, PreProd and Prod workspaces at the same time. Hence answer will be TRUE.

wsyhOption: A
May 13, 2023

Correct A

abhi6199Option: B
Jun 7, 2023

The correct Answer is B. https://developer.hashicorp.com/terraform/language/settings/backends/remote#workspaces

ska_torrent_430Option: B
Jun 13, 2023

Correct B

Busi57Option: B
Jul 23, 2023

the correct answer B

Jayanth
Jul 28, 2023

B. False

paromanu007
Aug 17, 2023

The remote backend can work with either a single remote Terraform Cloud workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses: Correct B

arnabsinha4uOption: B
Sep 18, 2023

correct B https://developer.hashicorp.com/terraform/language/settings/backends/remote#workspaces

NKSINGH
Nov 9, 2023

Correct B

liuyomzOption: B
Apr 23, 2024

B. prefix switching

hrajkuma
Jul 12, 2024

vote for B. False

purvakdevops91
Jul 22, 2024

Answer should be B False. Workspaces (offical documentation --> https://developer.hashicorp.com/terraform/language/settings/backends/remote#workspaces) The remote backend can work with either a single remote HCP Terraform workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses: To use a single remote HCP Terraform workspace, set workspaces.name to the remote workspace's full name (like networking-prod). To use multiple remote workspaces, set workspaces.prefix to a prefix used in all of the desired remote workspace names. For example, set prefix = "networking-" to use HCP Terraform workspaces with names like networking-dev and networking-prod. This is helpful when mapping multiple Terraform CLI workspaces used in a single Terraform configuration to multiple HCP Terraform workspaces.

erifOption: B
Oct 7, 2024

A single remote backend configuration can support multiple remote workspaces. In Terraform, remote backends like Terraform Cloud or remote state storage solutions can manage multiple workspaces, each representing a different environment or set of infrastructure, all within the same backend configuration.

eLJoudiOption: B
Mar 3, 2025

The remote backend can work with either a single remote HCP Terraform workspace, or with multiple similarly-named remote workspaces (like networking-dev and networking-prod). The workspaces block of the backend configuration determines which mode it uses: To use a single remote HCP Terraform workspace, set workspaces.name to the remote workspace's full name (like networking-prod).