Which scenario best describes when to use Terraform workspaces?
Think about how Terraform separates state for different deployments.
Terraform workspaces allow you to keep separate state files for different environments using the same configuration code.
You have a Terraform configuration for a web app. You want to deploy it to two AWS accounts: one for testing and one for production. How should you use workspaces?
Workspaces help manage multiple states but consider provider credentials.
Workspaces isolate state files, so you can deploy the same config to different accounts by switching workspaces and setting provider credentials accordingly.
What happens to the Terraform state when you switch from the 'default' workspace to a new workspace named 'feature'?
Think about how workspaces isolate state files.
Each workspace has its own state file. Switching to 'feature' loads its own state, separate from 'default'.
Which statement about security when using Terraform workspaces is true?
Consider how Terraform stores state and sensitive data.
Workspaces separate state files but do not encrypt them. Encryption and access control depend on the backend used.
In a large team managing multiple environments with Terraform, what is the best practice regarding workspaces?
Think about state isolation and team collaboration challenges.
Workspaces are good for temporary isolation like feature branches. For stable environments, separate configurations or backends reduce risk of accidental changes.