0
0
Terraformcloud~5 mins

Workspaces and remote state in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Terraform workspace?
A Terraform workspace is like a separate workspace folder where Terraform keeps its state files. It lets you manage multiple environments (like dev, test, prod) using the same configuration but with isolated states.
Click to reveal answer
beginner
Why use remote state in Terraform?
Remote state stores Terraform's state file in a shared place like cloud storage. This helps teams work together safely, avoids state conflicts, and keeps the state backed up and secure.
Click to reveal answer
intermediate
How does Terraform prevent state conflicts when using remote state?
Terraform uses locking mechanisms on remote state backends to prevent multiple people from changing the state at the same time, avoiding conflicts and corruption.
Click to reveal answer
beginner
What is the difference between local and remote state?
Local state is saved on your computer, which is simple but risky for teams. Remote state is saved in a shared service like AWS S3 or Terraform Cloud, making it safer and better for collaboration.
Click to reveal answer
intermediate
How do Terraform workspaces help manage multiple environments?
Workspaces let you switch between different state files easily without changing your code. For example, you can have a 'dev' workspace and a 'prod' workspace, each with its own infrastructure state.
Click to reveal answer
What does a Terraform workspace primarily isolate?
ATerraform configuration files
BProvider plugins
CState files
DTerraform CLI versions
Which of these is a benefit of using remote state?
AAllows multiple users to share state safely
BAutomatically writes Terraform code
CRuns Terraform faster locally
DRemoves the need for state files
What happens if two users try to update the remote state at the same time?
ATerraform ignores one user's changes
BTerraform merges the changes automatically
CTerraform deletes the state file
DTerraform locks the state to prevent conflicts
Where is local Terraform state stored by default?
AIn a database
BOn the user's local machine
CIn Terraform Cloud
DIn a cloud storage bucket
How do you switch between Terraform workspaces?
AUsing the command 'terraform workspace select <name>'
BBy editing the Terraform configuration file
CBy changing the provider version
DBy deleting the state file
Explain how Terraform workspaces help manage multiple environments.
Think about how you keep your work organized in different folders.
You got /4 concepts.
    Describe the benefits of using remote state in Terraform.
    Imagine sharing a single notebook safely with your team.
    You got /4 concepts.