Terraform Tutorial — The Terraform Ecosystem

3 minute read

Terraform is more than just a CLI tool. It’s an ecosystem of components that work together — the CLI you run locally, a public registry of reusable modules, a cloud platform for teams, and thousands of providers that connect Terraform to every major service.


Terraform CLI

The Terraform CLI is the open-source binary you install on your machine. It’s the core of everything — you write .tf files, and the CLI reads them to create, update, or destroy infrastructure.

Key commands you’ll learn throughout this tutorial:

Command Purpose
terraform init Download providers and modules
terraform plan Preview what will change
terraform apply Create or update infrastructure
terraform destroy Remove all managed infrastructure
terraform fmt Auto-format your .tf files
terraform validate Check for syntax errors

The CLI is all you need to get started. Everything else in the ecosystem is optional.


Terraform Registry

The Terraform Registry (registry.terraform.io) is a public library of two things:

Providers

Providers are plugins that teach Terraform how to talk to a specific platform. The AWS provider teaches Terraform how to create EC2 instances, S3 buckets, and VPCs. The Kubernetes provider teaches it how to create namespaces and deployments.

There are 3,000+ providers in the registry, including:

  • Major clouds: AWS, Azure, GCP
  • Monitoring: Datadog, PagerDuty, Grafana
  • DNS: Cloudflare, Route53
  • Version control: GitHub, GitLab, Bitbucket
  • Databases: MongoDB Atlas, Snowflake
  • Containers: Kubernetes, Docker, Helm

Modules

Modules are reusable Terraform configurations published by the community. Instead of writing a VPC from scratch (dozens of resources), you use a module:

module "vpc" {
  source  = "terraform-aws-modules/vpc/aws"
  version = "5.0.0"

  name = "my-vpc"
  cidr = "10.0.0.0/16"
}

The registry has thousands of modules for common patterns — VPCs, EKS clusters, RDS databases, IAM roles, and more.


Terraform Cloud

Terraform Cloud is HashiCorp’s SaaS platform that adds team collaboration features on top of the open-source CLI:

  • Remote state storage: State is stored securely in the cloud, not on your laptop
  • Remote plan/apply: Runs execute on Terraform Cloud’s servers, not locally
  • Team access controls: Define who can plan, who can apply, who can read
  • Policy as Code: Use Sentinel policies to enforce rules (“no public S3 buckets”)
  • VCS integration: Connect to GitHub/GitLab and trigger runs on pull requests
  • Cost estimation: See estimated cloud costs before applying

Terraform Cloud has a free tier for small teams (up to 5 users).


Terraform Enterprise

Terraform Enterprise is the self-hosted version of Terraform Cloud. Large enterprises use it when they need:

  • Infrastructure running inside their own data center or VPC
  • Custom SSO/SAML integration
  • Audit logging for compliance
  • Air-gapped environments with no internet access

For this tutorial, we’ll use the open-source CLI. Terraform Cloud and Enterprise are optional and covered in the Terraform Advanced tutorial.


Providers — The Heart of Terraform

A provider is a plugin that connects Terraform to a specific API. Without providers, Terraform can’t do anything.

┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│  Your .tf     │────▶│  Terraform    │────▶│  Cloud API    │
│  config files │     │  CLI +        │     │  (AWS, Azure, │
│               │     │  Provider     │     │  GCP, etc.)   │
└───────────────┘     └───────────────┘     └───────────────┘

When you run terraform init, the CLI downloads the providers you’ve specified and caches them in the .terraform/ directory.

Provider Examples

Provider What It Manages
hashicorp/aws AWS resources (EC2, S3, VPC, IAM, RDS, …)
hashicorp/azurerm Azure resources (VMs, Storage, VNets, …)
hashicorp/google GCP resources (Compute, GCS, BigQuery, …)
hashicorp/kubernetes Kubernetes resources (pods, services, …)
integrations/github GitHub repos, teams, webhooks
cloudflare/cloudflare Cloudflare DNS, WAF, Workers

You’ll learn how to configure providers in detail in the Providers chapter.


The Open-Source Story

Terraform was originally released under the Mozilla Public License 2.0 (MPL 2.0). In August 2023, HashiCorp changed the license to the Business Source License (BSL 1.1), which restricts competing SaaS offerings.

In response, the community created OpenTofu — a fork of Terraform that remains under the MPL 2.0 license, maintained by the Linux Foundation.

For beginners, this doesn’t change much — the CLI works the same way, the HCL syntax is identical, and everything you learn in this tutorial applies to both Terraform and OpenTofu.


What’s Next?

You now understand the pieces of the Terraform ecosystem. Next, let’s see exactly where Terraform fits in the DevOps toolchain — from CI/CD pipelines to GitOps workflows.


← Terraform vs Other Tools Terraform in the DevOps Toolchain →