Terraform workspace is a very logical concept where you can have multiple states of your infrastructure configuration. To put this in simple words if you are running an infrastructure configuration in a development environment then the same infrastructure can be run in the production environment.
The main benefit of terraforming workspaces we get is we can have more than one state associated with a single terraform configuration.
If you have not defined any workspace then there is always a default workspace created by terraform, so you always work in a default workspace of terraform. You can list the number of terraform workspaces by running the command terraform workspace show. Also, you can not delete the default workspace
In this lab session, we are going to see -
- What is Terraform workspace?
- How to create a new Terraform Workspace?
- How to create multiple Terraform Workspace?
- How to List all terraform workspace?
- How to switch between Terraform workspace?
- How to start an EC2 instance using dev and test workspace?
- How to delete Terraform workspaces?
How to use Workspaces in Terraform? - https://jhooq.com/terraform-workspaces/