Back to course

Workspace: Multiple Environments

Infrastructure as Code (Terraform & OpenTofu Mastery)

Isolation with Workspaces

How do you manage Dev, Staging, and Prod without copying your code? Workspaces.

bash tofu workspace new production tofu workspace list

Each workspace has its own state file. You can use ${terraform.workspace} in your code to change server names or sizes based on the environment.