From the course: HashiCorp Certified: Terraform Associate (003) Cert Prep by KodeKloud

Unlock this course with a free trial

Join today to access over 23,400 courses taught by industry experts.

Terraform workspace

Terraform workspace

- [Instructor] Let us now recap Workspaces in Terraform. We know by now that every Terraform configuration uses state file to provision and manage infrastructure, whether the state is stored locally or remotely. All the examples that we have seen so far has one-to-one mapping between the configuration directory and the state file. Here's an example of an AWS instance_type resource block called webserver. Let us assume that this instance is to be created for a development project and add a tag of environment as equal to development. And we have used an ami, an instance_type that suits the need for this Development webserver. Now, if you want to make use of the same configuration files to create similar resources for, say, a production environment, we can make use of workspaces. With workspaces, we can use the same configuration directory to create multiple infrastructure environments, such as the development and production environments. A workspace called default is automatically…

Contents