In the Using workspaces for managing environments recipe in Chapter 4, Using the Terraform CLI, we studied the use of some Terraform commands to manage and create workspaces. In Terraform's vision, workspaces make it possible to manage several environments by creating several Terraform state files for the same Terraform configuration.
In this recipe, we will go further with the use of workspaces by automating their creation in a CI/CD pipeline.