Recall & Review
beginner
What is the main purpose of using workspaces in Terraform?
Workspaces allow you to manage multiple environments (like development, staging, production) using the same configuration but with separate state files. This keeps environments isolated and prevents conflicts.
Click to reveal answer
beginner
How do Terraform workspaces help prevent resource conflicts?
Each workspace has its own state file, so resources created in one workspace do not affect resources in another. This separation avoids accidental changes across environments.
Click to reveal answer
intermediate
Why is it better to use workspaces instead of copying Terraform configurations for each environment?
Using workspaces avoids duplication of code and makes it easier to maintain and update infrastructure because all environments share the same configuration but keep their states separate.
Click to reveal answer
intermediate
What happens if you run Terraform commands without switching to the correct workspace?
Terraform will apply changes to the current workspace's state, which might cause unintended changes in the wrong environment, leading to potential errors or downtime.
Click to reveal answer
advanced
Can Terraform workspaces be used to manage completely different projects?
No, workspaces are designed to manage different environments of the same project. For different projects, separate Terraform configurations and state files are recommended.
Click to reveal answer
What does a Terraform workspace primarily separate?
✗ Incorrect
Workspaces separate state files, allowing multiple environments to use the same configuration without interfering with each other's resources.
Which command switches to a different Terraform workspace?
✗ Incorrect
The correct command to switch workspaces is 'terraform workspace select '.
Why should you avoid copying Terraform configs for each environment?
✗ Incorrect
Copying configs leads to duplicated code, making updates and maintenance more difficult and increasing the chance of mistakes.
What risk exists if you forget to switch to the correct workspace before applying changes?
✗ Incorrect
Applying changes in the wrong workspace can cause unintended modifications in the wrong environment.
Can Terraform workspaces manage multiple unrelated projects?
✗ Incorrect
Workspaces are intended to separate environments within the same project, not different projects.
Explain how Terraform workspaces help manage multiple environments safely.
Think about how workspaces keep environments from mixing up their resources.
You got /4 concepts.
Describe the risks of not using workspaces or not switching workspaces correctly in Terraform.
Consider what happens if Terraform state files get mixed up.
You got /4 concepts.