Getting Comfortable with Terraform: Infrastructure as Code (IAC)

When I started working in cloud and DevOps, one of the first tools I heard about—again and again—was Terraform. At first, it seemed a bit abstract: writing code to manage infrastructure? But as I got deeper into it, I realized how powerful (and necessary) Infrastructure as Code (IaC) really is—especially in a world where environments need to be consistent, repeatable, and scalable. What Is Terraform? Terraform is an open-source Infrastructure as Code tool created by HashiCorp. It lets you define your cloud infrastructure—servers, networks, storage, and more—as code, using a simple declarative language called HCL (HashiCorp Configuration Language). Instead of manually clicking through a cloud console or running ad hoc CLI commands, you can write out exactly what you want your environment to look like—and Terraform makes it happen. For example, you can: Spin up a virtual machine Set up networking rules Deploy a load balancer Configure cloud storage Instead of manually clicking through a cloud console or running ad hoc CLI commands, you can write out your infrastructure as code—usually across multiple .tf files that represent different parts of your setup. For example, you might have one file for a networking resource, another for compute resources, and another for variables. Once defined, Terraform reads all the .tf files in the directory and ensures your cloud environment matches that configuration—consistently and reliably. Why Terraform Matters As someone early in my DevOps journey, I've found Terraform especially valuable for a few key reasons: Repeatability: I can recreate the same environment multiple times, without worrying about missing a step. Version Control: My infrastructure lives in Git, right next to my app code. Team Collaboration: Other engineers can review and suggest changes just like with any codebase. Cloud Agnostic: While I mostly work with Oracle Cloud (OCI), Terraform also supports AWS, Azure, GCP, and more. It gives structure and sanity to a process that could otherwise be chaotic, especially when you're managing resources across different environments (dev, staging, production, etc.). How Terraform Works Terraform is run from the terminal using commands like: terraform init: sets up the project and downloads required plugins (like the OCI provider) terraform plan: shows what Terraform will do, based on your code terraform apply: actually creates or updates infrastructure in the cloud These commands use stored credentials to connect with your cloud provider—in my case, Oracle Cloud Infrastructure (OCI). While OCI also has a web console where you can manage things manually, Terraform lets you define everything as code for better consistency and control. Exploring Visualization Tools Lately, I’ve been interested in ways to visualize what Terraform will change before running apply. Seeing a plan in a diagram or graph can make complex setups easier to understand—especially when you're learning or working in a team. I haven’t explored them in depth yet, but tools like Pluralith (which generates visual diagrams from plans) and Blast Radius (which shows interactive dependency graphs), shown above, look like great ways to level up how I work with infrastructure.

May 29, 2025 - 18:00
 0
Getting Comfortable with Terraform: Infrastructure as Code (IAC)

When I started working in cloud and DevOps, one of the first tools I heard about—again and again—was Terraform. At first, it seemed a bit abstract: writing code to manage infrastructure? But as I got deeper into it, I realized how powerful (and necessary) Infrastructure as Code (IaC) really is—especially in a world where environments need to be consistent, repeatable, and scalable.

What Is Terraform?

Terraform is an open-source Infrastructure as Code tool created by HashiCorp. It lets you define your cloud infrastructure—servers, networks, storage, and more—as code, using a simple declarative language called HCL (HashiCorp Configuration Language).

Instead of manually clicking through a cloud console or running ad hoc CLI commands, you can write out exactly what you want your environment to look like—and Terraform makes it happen.

For example, you can:

Spin up a virtual machine

Set up networking rules

Deploy a load balancer

Configure cloud storage

Instead of manually clicking through a cloud console or running ad hoc CLI commands, you can write out your infrastructure as code—usually across multiple .tf files that represent different parts of your setup. For example, you might have one file for a networking resource, another for compute resources, and another for variables.

Once defined, Terraform reads all the .tf files in the directory and ensures your cloud environment matches that configuration—consistently and reliably.

A Load Balancer resource in the OCI console, which can be created either manually or through IAC code

Why Terraform Matters

As someone early in my DevOps journey, I've found Terraform especially valuable for a few key reasons:

Repeatability: I can recreate the same environment multiple times, without worrying about missing a step.

Version Control: My infrastructure lives in Git, right next to my app code.

Team Collaboration: Other engineers can review and suggest changes just like with any codebase.

Cloud Agnostic: While I mostly work with Oracle Cloud (OCI), Terraform also supports AWS, Azure, GCP, and more.

It gives structure and sanity to a process that could otherwise be chaotic, especially when you're managing resources across different environments (dev, staging, production, etc.).

How Terraform Works

Terraform workflow

Terraform is run from the terminal using commands like:

terraform init: sets up the project and downloads required plugins (like the OCI provider)

terraform plan: shows what Terraform will do, based on your code

terraform apply: actually creates or updates infrastructure in the cloud

These commands use stored credentials to connect with your cloud provider—in my case, Oracle Cloud Infrastructure (OCI). While OCI also has a web console where you can manage things manually, Terraform lets you define everything as code for better consistency and control.

Exploring Visualization Tools

Lately, I’ve been interested in ways to visualize what Terraform will change before running apply. Seeing a plan in a diagram or graph can make complex setups easier to understand—especially when you're learning or working in a team.

Blast Radius tool used for visualizing terraform plan for cloud infrastructure

I haven’t explored them in depth yet, but tools like Pluralith (which generates visual diagrams from plans) and Blast Radius (which shows interactive dependency graphs), shown above, look like great ways to level up how I work with infrastructure.