Member-only story
The Benefits of Using Remote State in Terraform, and Best Practices
Keep your state files remote instead of local
Terraform is a cloud agnostic Infrastructure as Code tool, which means that you can setup config files that are designed to work with any type of cloud provider (AWS, Azure, GCP, etc.).
Regardless of your opinion on it or if you use it at all, I think we can all agree that using remote state is a much more efficient and secure option than storing the state locally in a traditional terraform.tfstate file. If this is a new concept to you I will explain why it is a highly recommended best practice, and we will also go over some best practices to consider when working with remote state.
What is a state file, and what are the benefits of using it remotely?
In Terraform, a state file is a file that contains information about the current configuration of the infrastructure being managed by Terraform. It is used by Terraform to determine the difference between the current state and desired state of your architecture, and to make the necessary changes to bring the infrastructure into compliance. It is also used to keep track of the resources that have been created so that Terraform can manage and update them over time.