- Terraform is a technology that allows you to deploy your infrastructure using code.
- It uses YAML as a file format.
- It needs registered providers to create the desired infra in the right environment.
- You can create infra on Azure, AWS as well as on premise.
When to use it?
When your project requires a specific infrastructure, you can easily create it using terraform. This being basically code, you can source control it. You can also create the infrastructure in multiple environments.
Let’s say you often publish website that have azure functions acting as the backend. You can have one terraform script that will create the new infrastructure whenever needed, just by running the script. No manual intervention is needed.
This means you can reuse the script to create the infra multiple times or customise it sufficiently in order to reuse it for other projects as well.
How?
You need basically one file: main.tf which is going to contain all the resources you want to create. You can use variables that will be put in the variables.tf file or directly in the main.tf if your script is small or you don’t want multiple files. I recommend using the variables.tf and also splitting up the main.tf when your script becomes too big to be readable in one file.
Available providers
When deploying in the cloud, you have access to different providers that allow terraform to connect to your tenant and create the infrastructure. There are 3620 different providers. You can then them here.
In conclusion, Terraform is helpful but beware as the apparent simplicity can hide a world of hardships and difficulties.