From the course: Terraform Essential Training: State Management and Backends
Unlock this course with a free trial
Join today to access over 26,000 courses taught by industry experts.
Compare local vs. remote state backends - Terraform Tutorial
From the course: Terraform Essential Training: State Management and Backends
Compare local vs. remote state backends
If you do not explicitly configure a backend for your Terraform configuration, then Terraform would use the local backend by default. With the local backend, Terraform stores the state file as a file on your local file system. This would be similar to your GPS device storing its coordinates, its historical paths and your destination on the device itself. Let's go to my VS Code environment and take a look at the following Terraform configuration. In this case, I haven't configured any explicit backend configuration. So in this case, Terraform will just store the state file next to my Terraform configuration as terraform.tfstate. However, if I want to be explicit about where I store the state file on my local file system, I can add explicit configuration for the local backend. I can give it a path and say that I want to store it in a directory called state, and I want to call it terraform.tfstate, like this. Now the state file will be stored inside of this state directory. And in case…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.