DEV Community

Gabrielle Eduarda
Gabrielle Eduarda

Posted on

What is Terraform? Infrastructure as Code, Simplified

If you've ever had to provision cloud resources manually, you know how painful and error-prone it can be. Copying console settings, forgetting region configs, mismatching IAM roles — it gets messy, fast.

That's where Terraform comes in.

Terraform is an open-source tool developed by HashiCorp that allows you to define, provision, and manage infrastructure using code — known as Infrastructure as Code (IaC). Instead of clicking around in cloud consoles, you write declarative configuration files that describe what your infrastructure should look like.


Key Concepts

  • Declarative language (HCL): You define what you want (not how to do it)
  • Providers: Plugins for different platforms like AWS, Azure, GCP, GitHub, etc.
  • Resources: Basic building blocks (e.g., an S3 bucket, an Azure App Service)
  • State file: Tracks what Terraform has created and manages drift detection
  • Modules: Reusable and composable chunks of infrastructure logic

What can you build with Terraform?

  • Virtual networks and firewalls
  • Databases, storage buckets, compute instances
  • Kubernetes clusters (EKS, AKS, GKE)
  • CI/CD pipelines
  • DNS zones, CDN distributions, SSL certificates
  • Permissions and IAM roles

Basically: if it’s in the cloud, Terraform probably supports it.


Why I use Terraform

  • Consistency: Same configuration in all environments (dev, staging, prod)
  • Version control: IaC stored in Git, enabling reviews and history
  • Automation: Easy integration with CI/CD pipelines
  • Multi-cloud support: One tool for AWS, Azure, and others
  • Documentation: Code is the documentation

Real-world tip

In my projects, I keep environments isolated using workspaces or folders, tag everything for cost tracking, and use terraform plan before every apply. And yes — always back up your state file (or use remote state with locking).


Final thoughts

Terraform changed the way I approach infrastructure. It made things reproducible, scalable, and auditable. Whether you're managing two servers or two hundred services, it gives you the confidence that what you provision is what you intended.

Want to see a real Terraform setup? Let me know — happy to share examples!

Top comments (0)