The Terraform State File
Explore how Terraform uses state files to track managed resources and what happens when state files are removed. Learn to apply changes with the -auto-approve flag and understand its risks to maintain infrastructure consistency.
We'll cover the following...
We'll cover the following...
A .tfstate file was created when we ran terraform init in the previous lesson. Here, we’ll examine that file and see what happens if we lose it. The more we use Terraform, the more important it is to understand Terraform state management, especially if we work in teams.
A look at the state file
To get a state file, we create a new directory named ltthw_state and a hello_state.tf file within it. Then we execute terraform init and terraform apply. This time we add a new flag: -auto-approve.
The -auto-approve gets ...