We have decided at Deployflow to spend the month of June on helping you understand better the Terraform and how it can improve your organisations’ workflow.
Terraform is a tool for provisioning, building, managing, changing and versioning your infrastructure using the code. The beauty of this approach is that you can use your code repository, and benefits of it like access control and version control to control, manage and grow your solution.
Because Terraform is created by company Hashicorp, an independent vendor they benefit from the ability to link it to many different platforms. You can create your Terraform code for Azure, AWS, Google, VMware and many more, you can see the list of the platform the code work with here: https://www.terraform.io/docs/providers/index.html. There is constant development of new providers so that list is going to continue to grow with time, and as it’s a platform that is not linked to a specific cloud provider or vendor, there is going to be long term support.
One of the interesting feature of Terraform, is that it’s capable to manage your Infrastructure-as-a-Service, Platform-as-a-Service and Software-as-a-Service – basically, any service that has API with lifecycle associated with it Terraform can be used to manage. Allowing you to have unified management of the platforms that are used to deliver your solution.
Currently, on the market, we do not see any clear competitor to Terraform in terms of the overall capabilities. There are solutions like AWS CloudFormation, but they are linked to one specific vendor preventing you from easily deploying to another vendor. We do have as well platform like Puppet and Ansible, but they do apply more to an already deployed infrastructure and lack the level of abstraction on the environment to manage it efficiently.
Terraform deployment is split into three steps:
- Refresh – this connects to your provider, and checks what is out there, how is it configured and what is in place.
- Plan – this compares what the environment should be based on the configuration files vs what is within the environment already, and then determine how to get to that state.
- Apply – this goes ahead and implement the changes that have been determined in the plan step, the Terraform code is capable of understanding the dependencies between resources, allowing you to make sure you create the right items in the right order.
Upon the execution of those steps, all the changes and details are stored into the state file, that is used to keep details of how and what has been configured to check against the refresh step. And it allows Terraform to destroy any resource that has been created if you have removed it from the code, making sure that the environment remains clean.
At Deployflow we invest a lot of time and effort into delivering projects to our clients using Terraform, as we have found this to be a very flexible platform allowing us to improve the delivery of customers solutions
In the next post, we will look into creating the Terraform code and explaining the Terraform structure.