Terraform is a tool for infrastructure management. That means that Terraform goes in and deploys the infrastructure, creates the virtual machines, the networking part, the storage entities and any other services around them.
In essence, this infrastructure tool is able to create any of the components you need to run any of your services and applications. It approaches this task by treating infrastructure code the same as software code.
The short definition of Terraform is as follows: Terraform is a tool for defining a virtual infrastructure in code.
It’s a very versatile tool, used not just for defining a virtual infrastructure in code in a human friendly language but also for deploying it across hundreds of cloud providers.
Read more about what is Terraform and what kind of problems is Terraform actually attempting to solve, here.
First of all, Terraform is a tool for infrastructure management.
Ansible and other similar tools are configuration management tools. It means that they are meant to configure or connect to and execute some tasks on that infrastructure that has been previously deployed by Terraform.
Actually, the process is designed, as a best practice, to use Terraform to create your instances, your networking, your policies, then you can use Ansible to come on top of this infrastructure, connect to your running instances and configure them further.
Read more about Ansible vs Terraform, here.
One of the greatest advantages of Terraform is its knowledge of state. This means that at any point Terraform will try to keep an up-to-date overview and up-to-date knowledge of what has already been deployed.
Terraform will know if it needs to deploy it completely, partially or not at all.
If your infrastructure has already been deployed, Terraform is going to tell you that your infrastructure is up to date and it's not going to attempt to redeploy it from scratch, it's not going to duplicate your infrastructure, but because of the state knowledge Terraform also knows which part of the infrastructure is already in the cloud.
Find out more about Terraform Code and architecture, here.
DevOps is a movement. This movement is meant to bring together two traditionally separate types of teams: developers who write the applications and the operations people - the admins, who are responsible for making sure that the code runs properly.
Traditionally, developers needed to focus on just building the applications, while the operations people only took care of the physical or virtual infrastructure along with everything in it: computers, storage, networking, securing access, users, and so on.
Learn more about the role of Terraform and how it fits into the DevOps ecosystem by taking the Terraform Course.