What is the primary purpose of Terraform workspaces?
Think about how Terraform handles state files for different environments.
Terraform workspaces allow you to use the same configuration but keep separate state files, which is useful for managing multiple environments like dev, staging, and prod.
Which statement best describes directory-based separation in Terraform?
Consider how physical file organization affects Terraform state and configuration.
Directory-based separation means creating separate folders each with its own Terraform files and state, isolating environments or projects physically on disk.
Which scenario is best suited for using Terraform workspaces instead of directory-based separation?
Think about when sharing the same configuration but separating state is helpful.
Workspaces are ideal when environments share the same code but need separate states, like dev and prod with minor differences.
Which security risk is more likely when using Terraform workspaces compared to directory-based separation?
Consider how workspaces share the same configuration but differ only by state.
Because workspaces use the same configuration, a user might accidentally apply changes to the wrong workspace, affecting the wrong environment.
Given the following Terraform commands run in sequence, what is the output of terraform workspace show after the last command?
terraform workspace new staging terraform workspace select default terraform workspace list terraform workspace show
Remember the effect of terraform workspace select on the active workspace.
The commands create a new workspace named 'staging', then switch back to 'default'. The list shows both workspaces. The last command shows the currently selected workspace, which is 'default'.