Why you should be using tools like Terraform in 2023

Eunan Hardy
4 min readMar 19, 2023

In recent years, Infrastructure as Code (IaC) has gained significant popularity, enabling developers and IT teams to automate the provisioning and management of infrastructure in a more efficient and scalable way. One of the leading tools in this area is Terraform, an open-source tool by HashiCorp that allows users to write, plan, and create infrastructure as code.

The basic concept of Terraform revolves around the idea of defining infrastructure as code. This means that infrastructure resources such as virtual machines, storage, and networking are defined using a high-level configuration language. The configuration files are written in HashiCorp Configuration Language (HCL) or JSON, which allows users to define their infrastructure using simple and readable code.

Terraform works by creating a graph of all the resources and dependencies in your infrastructure. It then uses this graph to determine the order in which resources need to be created or updated. This ensures that all resources are created in the correct order and with the correct dependencies. This is refered to as state

One of the key benefits of using Terraform is that it allows you to automate the deployment and management of your infrastructure. This reduces the risk of manual errors and improves the reliability of your infrastructure. Terraform also enables you to version control your infrastructure code, which means that you can easily roll back changes or collaborate with other team members.

Another advantage of using Terraform is that it provides a consistent and repeatable way to deploy infrastructure. This means that you can deploy the same infrastructure configuration multiple times with the same result. This is particularly useful for creating test environments or for scaling up your infrastructure.

Terraform also provides a wide range of integrations with other tools and services. For example, it can be integrated with continuous integration and continuous deployment (CI/CD) tools such as Jenkins and GitLab. It can also be used with configuration management tools such as Ansible and Puppet.

Below is an example of how easy it is to create resources with terraform for both GCP and AWS.

Spinning up a virtual machine in GCP:

# provider configuration
provider "google" {
project = "my-gcp-project"
region = "us-central1"
# resource definition
resource "google_compute_instance" "example-vm" {
name = "example-vm"
machine_type = "n1-standard-1"
zone = "us-central1-a"

boot_disk {
initialize_params {
image = "debian-cloud/debian-10"

network_interface {
network = "default"
access_config {
# Allocate a one-to-one NAT IP to the instance

Creating a storage bucket in Amazon S3:

# provider configuration
provider "aws" {
region = "us-west-2"
# resource definition
resource "aws_s3_bucket" "example-bucket" {
bucket = "example-bucket"
acl = "private"

tags = {
Name = "Example Bucket"
Environment = "Production"

Running terraform plan on the resource above will generate the intended changes to your terraform state seen below.

+ resource "aws_s3_bucket" "example-bucket" {
+ acceleration_status = (known after apply)
+ acl = "private"
+ arn = (known after apply)
+ bucket = "example-bucket"
+ bucket_domain_name = (known after apply)
+ bucket_regional_domain_name = (known after apply)
+ force_destroy = false
+ hosted_zone_id = (known after apply)
+ id = (known after apply)
+ region = (known after apply)
+ request_payer = (known after apply)
+ tags = {
+ "Environment" = "Production"
+ "Name" = "Example Bucket"
+ website_domain = (known after apply)
+ website_endpoint = (known after apply)
Plan: 1 to add, 0 to change, 0 to destroy.

In addition to the benefits mentioned above, using infrastructure-as-code with tools like Terraform has several other advantages. These include:

  • Improved collaboration: By using code to manage infrastructure, multiple team members can work on the same infrastructure configuration file simultaneously. This can help improve collaboration and reduce the risk of conflicts or errors.
  • Increased efficiency: Infrastructure-as-code allows you to automate the deployment and management of your infrastructure. This reduces the time and effort required to deploy new resources or make changes to existing ones.
  • Greater flexibility: Infrastructure-as-code enables you to easily test and iterate on your infrastructure configuration. This makes it easier to experiment with different configurations or to adapt to changing business requirements.
  • Enhanced security: Infrastructure-as-code allows you to define security controls and policies as code. This means that security configurations can be version-controlled and audited, which helps to ensure that your infrastructure is secure and compliant.

In conclusion, Infrastructure as Code (IaC) is a crucial practice for organizations to optimize their infrastructure management. IaC improves efficiency, reliability and scalability, while reducing errors and costs. Terraform, along with other IaC tools, is an essential component for implementing IaC standards. It allows teams to write, plan, and create infrastructure as code. Adopting IaC standards, including the use of tools like Terraform, will streamline infrastructure management workflows, increase productivity, shorten time-to-market, and reduce operational costs.



Eunan Hardy

I work on a lot of different software development projects and apps, sometimes I write about them.