DEV Community

Domenico Solazzo
Domenico Solazzo

Posted on

Using Terraform? What is your biggest advice...

I am starting using Terraform in the past few weeks.

Which advice do you have for the whoever is starting with Terraform?

What are your tips&tricks while using Terraform?

Discussion (3)

tmidi profile image
Taleeb Midi

two short advices:
1) use a remote backend Backends, this especially mandatory if you are using terraform with others,
2) use modules whenever possible. Terraform is working on adding more functionality to modules, and with the release of 0.13 (still in Alpha). more functionality will be added, notably using for_each loops.

sujithq profile image
Sujith Quintelier • Edited on

3) make sure you have a .gitignore file
4) make use of so you can test it locally. Here you can put sensitive data and in combination with .gitignore it won't be checked in.
5) use terraform validate before checking in

hi_artem profile image

Terraform, and IAC in general, is still pretty new thing so doesn't have as many conventions around as traditional programming.
For someone just getting starting you should definitely checkout Hashicorp Learning Center. It is updated pretty regularly, and material is structured so that it builds up on each other.
Also, I think you should read upon what Terraform really does for you, and what is stored in the files created on initialization. This way, you will understand why remote backend is important. Same with modules. Just start using the tool, and you will come to a case where they are needed.
Anyway, enjoy! Terraform is lot's of fun!