What is the primary purpose of Terraform workspaces?
Think about how Terraform separates environments using the same code.
Terraform workspaces allow you to use the same configuration but keep separate state files for different environments or instances.
Which backend configuration snippet correctly sets up Terraform to use an AWS S3 bucket for remote state storage with state locking?
Look for the option that includes state locking and encryption.
Option A correctly configures the S3 backend with encryption and DynamoDB table for state locking, which prevents concurrent state modifications.
You have a Terraform configuration for a web app. You want to deploy it to dev, staging, and production environments. Which approach best uses Terraform workspaces to manage these environments?
Think about how workspaces isolate state but share configuration.
Using separate workspaces for each environment allows you to reuse the same configuration while keeping state isolated per environment.
Which practice best secures access to Terraform remote state stored in an AWS S3 bucket?
Consider AWS best practices for securing sensitive data.
Restricting access with IAM policies ensures only authorized users can read or modify the remote state, protecting sensitive infrastructure data.
Given a Terraform configuration with multiple workspaces, what happens to the state when you run terraform workspace select staging?
Think about how workspaces isolate state files.
Switching workspaces loads the state specific to that workspace, keeping resources isolated per environment.