Terraform, developed by HashiCorp, is a popular IaC tool. However, alternatives are available, including:
AWS CloudFormation is Amazon Web Services’ native IaC tool. It allows users to define and provision AWS infrastructure using JSON or YAML templates. Unlike Terraform, CloudFormation is tightly integrated with AWS services and provides native support for AWS resources.
Azure Resource Manager (ARM) and Google Cloud Deployment Manager are Microsoft Azure’s and Google Cloud Platform’s native IaC tools, respectively.
Ansible is a configuration management and automation tool that can also be used for infrastructure provisioning. It uses simple YAML-based playbooks to define tasks and configurations. While Ansible offers some similarities to Terraform, its focus is more on configuration management rather than infrastructure provisioning.
Chef and Puppet are also commonly used configuration management tools, but they can also be used to provision infrastructure. However, compared to Terraform, they might not provide the same infrastructure provisioning capabilities.
The list above is non-exhaustive, and a wide range of IaC tools are available, such as Pulumi and OpenStack Heat. A thorough comparison of features provided by these IaC tools is beyond the scope of this blog.
Terraform uses declarative human-readable configuration files to define and provision infrastructure. It works with over 1000 infrastructure providers, including Amazon Web Services (AWS), Google Cloud Platform (GCP), Azure, Kubernetes, and others. It allows us to write custom providers as well.
Terraform uses HashiCorp Configuration Language (HCL) to define IaC. HCL uses a declarative syntax to describe the desired state of infrastructure rather than specifying the sequence of actions needed to achieve that state.
It is important to note that Terraform uses declarative language, and this makes it different from some other procedural IaC tools that require step-by-step instructions. Again, a thorough discussion of the pros and cons of this approach is beyond the scope of this blog.
The overall process involves first writing the desired infrastructure as code using HCL. Then, we initialize Terraform to install any plugins required to interact with the infrastructure. Afterward, we instruct Terraform to apply the required changes on the platform (we can optionally preview the changes being made first). The overall process is represented in the figure below: