Understanding Terraform: A Beginner's Perspective

Ms. BMs. B
3 min read

In this article, I would be introducing you to Terraform, giving you a brief description of what we can do with it.

What is Terraform?

HashiCorp created the open-source Infrastructure as Code (IaC) tool Terraform. HashiCorp Configuration Language (HCL), a high-level declarative configuration language, or optionally JSON can be used to define, provide, and manage infrastructure.

Let’s take a look at what Terraform does;

What Does Terraform Do?

Terraform enables you to define infrastructure in code, such as:

  • Compute resources (VMs, containers)

  • Networking components (VPCs, subnets, gateways)

  • Storage (buckets, volumes)

  • DNS, databases, and more

Once defined, Terraform automates the provisioning and management of these resources across various cloud providers (like AWS, Azure, Google Cloud), as well as on-premise solutions and other third-party services.

Core Concepts of Terraform

  1. Infrastructure as Code (IaC): Terraform configurations may be reviewed, versioned, and reused in the same manner as application code because they are written as code.

  2. Declarative Language: Terraform determines how to get your infrastructure to the desired end state when you specify it.

  3. Execution Plan: Terraform creates an execution plan that outlines the steps it will take to add, alter, or remove resources in order to get to the desired state when you run terraform plan.

  4. State Management: Terraform keeps a state file (terraform.tfstate) to track the infrastructure it manages. This state is critical for knowing what has been deployed and for planning future changes.

  5. Providers: Providers are plugins that enable interaction with different platforms (e.g., AWS, Azure, Kubernetes). Example: provider "aws" { region = "us-west-2" }

  6. Modules: Modules are containers for multiple resources that are used together. They promote reusability and organization. You can write your own or use pre-built ones from the Terraform Registry.

Example Use Cases:

  • Spinning up servers and databases

  • Creating and managing networking infrastructure (VPCs, subnets, load balancers)

  • Automating cloud resource provisioning in CI/CD pipelines

In short, Terraform helps teams manage infrastructure as software, improving automation, consistency, and collaboration.

Typical Workflow

  1. Write .tf configuration files using HCL.

  2. Initialize with terraform init (downloads providers).

  3. Plan changes using terraform plan.

  4. Apply changes using terraform apply.

  5. Destroy resources using terraform destroy (when needed).

Terraform's ability to work across many clouds is one of its most significant advantages. With only one tool, you can manage infrastructure across: AWS, Azure, Google Cloud, Kubernetes, DigitalOcean, On-premises solutions (such as VMware).

You may also expand Terraform with:

  • Custom Providers

  • Provisioners (to run scripts post-deployment)

  • Remote Backends (to share state across teams)

Advantages of Terraform

  • Consistency: Reduces manual errors and assures predictable infrastructure.

  • Version Control: Infrastructure definitions can be saved in Git.

  • Automation: Easy to incorporate into CI/CD pipelines.

  • Collaboration: Teams can build on infrastructure together.

Limitations and Challenges of Terraform

  • Learning Curve: HCL and state management can be challenging for beginners.

  • State Conflicts: State conflicts can occur when many users modify infrastructure at the same time, unless locking is implemented.

  • Complexity in Large Projects: Modules and backends may need to be properly structured.

If you enjoyed this article, stay tuned for my page where I would show you how to use this wonderful tool.

Please like, comment and share.

2
Subscribe to my newsletter

Read articles from Ms. B directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ms. B
Ms. B

Hi, I'm a tech enthusiast who has decided to document her cloud journey as the day goes by. Stay tuned and follow me through this journey which I believe would be a wonderful experience. I'm also a team player who loves collaborating with others to create innovative solutions.