Terraform Best Practices

Ravi Yasakeerthi
3 min readApr 6, 2022

Terraform is one of the most popular Infrastructure as a Code tool among cloud operations people. It’s very convenient to use with any cloud provider and you don’t have to spend a lot of time learning it as it is a declarative language, meaning you just need to define the end-result then the terraform will figure out what needs to be done.

Previously I have discussed the importance of Infrastructure as a code and the Basics of Terraform here, Hence I’m going to directly jump into the main topic which is best practices.

1. Shared remote storage for state file.

By default, Terraform stores its state locally. But If you are working in a team environment everyone needs to have access to the latest state file. Hence it’s always recommended to configure shared remote storage to store the state file. Also, keep in mind to secure this file as it may contain sensitive information.

2. Use State Locking to prevent corrupting your state.

--

--