DEV Community

Cover image for Introduction to IAC, how Terraform Works- Day01
Brian Mengo
Brian Mengo

Posted on

Introduction to IAC, how Terraform Works- Day01

Day01 of my 30day AWS terraform challenge, and I begin with highlighting what IaC is and how teams are using it to manage infrastructure in the cloud.
Infrastructure as Code (IaC) is the practice of managing and provisioning computing infrastructure through machine-readable configuration files rather than through manual processes or interactive configuration tools.
Think of it like this: instead of clicking through a cloud console to spin up servers, databases, and networks, you write code that describes exactly what you want — and a tool builds it for you.

Tools for Infrastrucure as Code:

  • Terraform (Multi-cloud and widely used)
  • Pulumi
  • AWS CloudFormation, AWS CDK, AWS SAM
  • Azure ARM / Bicep
  • GCP Deployment Manager, GCP Config Controller

What is Terraform
Terraform is an open-source IaC tool created by HashiCorp. It allows you to define, preview, and deploy infrastructure across multiple cloud providers — AWS, Azure, Google Cloud, and hundreds more — using a simple, human-readable language called HCL (HashiCorp Configuration Language).

Manual provisioning of Infrastructure Challenges;

  • Time-consuming: A simple three-tier app infrastructure can take around 2 hours to set up manually.
  • Complexity grows exponentially when managing multiple environments
  • Human error risks: Manual steps increase chances of misconfiguration, security oversights, or inconsistent environments
  • Inconsistency: Different people provisioning environments can lead to "it works on my machine" issues.
  • High operational costs and delays affecting dependent teams

*Benefits of Terraform
*

  • Automates the process.
  • Reduces time needed to perform the same action again and again.
  • Reduces labour resource which was needed to manual perform the process.
  • Reduces the chances of human error.
  • We can track changes using git.

How Terraform Works
Terraform Initialise - Run terraform init to initialize the working directory and download necessary providers.
Validate Configuraion - Run terraform validate to check for syntax or configuration errors.
Terraform Plan - Run terraform plan to preview infrastructure changes before applying.
Terraform apply - Run terraform apply to provision or modify the infrastructure by calling cloud API.
Terraform Destroy - Run terraform destroy to delete resources when no longer needed.

Getting Started

  1. Install Terraformdeveloper.hashicorp.com/terraform/install
  2. Set up a cloud provider account (AWS Free Tier is great for learning)
  3. Write your first .tf file and run terraform init, terraform plan, terraform apply
  4. Explore the Terraform Registryregistry.terraform.io for modules and providers

Top comments (0)