0
0
Terraformcloud~5 mins

Workspaces vs directory-based separation in Terraform - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is a Terraform workspace?
A Terraform workspace is a way to have multiple instances of the same infrastructure configuration, each with its own state, allowing you to manage different environments like dev, test, and prod within the same directory.
Click to reveal answer
beginner
How does directory-based separation differ from using workspaces in Terraform?
Directory-based separation means creating separate folders for each environment with its own Terraform files and state, while workspaces use one directory but switch states internally to manage multiple environments.
Click to reveal answer
intermediate
What is a key advantage of using Terraform workspaces over directory-based separation?
Workspaces allow you to reuse the same configuration files for multiple environments, reducing duplication and making it easier to maintain consistent infrastructure setups.
Click to reveal answer
intermediate
What is a potential downside of using Terraform workspaces?
Workspaces can be confusing because the same configuration is used for all environments, so mistakes in variable values or state management can affect multiple environments if not handled carefully.
Click to reveal answer
intermediate
When might directory-based separation be preferred over workspaces?
Directory-based separation is preferred when environments have very different configurations or when teams want clear physical separation of code and state files to avoid accidental changes across environments.
Click to reveal answer
What does a Terraform workspace primarily manage?
ASeparate state files for different environments
BDifferent Terraform versions
CMultiple cloud providers in one config
DUser access permissions
Which method involves creating separate folders for each environment?
ARemote state backend
BTerraform workspaces
CTerraform modules
DDirectory-based separation
What is a benefit of using workspaces instead of directories?
AEasier to maintain one set of configuration files
BBetter security isolation
CSupports different Terraform versions per environment
DAllows multiple cloud providers in one workspace
Which is a risk when using Terraform workspaces?
ACannot use variables
BDuplicating configuration files
CAccidentally applying changes to the wrong environment
DHard to share state files
When is directory-based separation most useful?
AWhen you want to use one state file
BWhen environments have very different configurations
CWhen you want to avoid using variables
DWhen using only one environment
Explain the difference between Terraform workspaces and directory-based separation.
Think about how state and configuration files are organized.
You got /4 concepts.
    Describe a scenario where you would choose Terraform workspaces over directory-based separation.
    Consider when reusing configuration is helpful.
    You got /4 concepts.