Module 1: Infrastructure as Code with Terraform

Lesson 1.3: Multi-Cloud, Hybrid, and Service-Agnostic Workflows

Plain language

Terraform core knows nothing about AWS, Azure, or GitHub. All platform knowledge lives in providers, which are plugins that translate Terraform's create, read, update, and delete operations into a platform's API calls. Thousands of providers are published on the Terraform Registry.

That design gives you:

  • Multi-cloud: AWS, Azure, and GCP resources in one configuration with one workflow.
  • Hybrid cloud: on-premises platforms such as VMware vSphere or Nutanix alongside public cloud.
  • Service-agnostic: non-infrastructure services such as GitHub, Cloudflare DNS, Datadog, PagerDuty, Okta, Kubernetes, and Vault.

The workflow is the same everywhere: init → plan → apply.

Under the hood

  • Terraform core and each provider are separate binaries. terraform init downloads providers, and core talks to each one over an RPC plugin protocol.
  • One run can include resources from many providers. Terraform can also pass outputs from one provider's resources into another's. For example, it can create a cloud load balancer and then create a Cloudflare DNS record pointing at its IP.
HCL
# Illustrative, not a lab file. One config, three providers, one workflow.
# (Provider configuration and credentials omitted for brevity.)
resource "aws_lb" "web" {
  name               = "web-lb"
  load_balancer_type = "application"
  subnets            = var.subnet_ids
}

resource "cloudflare_dns_record" "web" {
  zone_id = var.zone_id
  name    = "www"
  type    = "CNAME"
  content = aws_lb.web.dns_name # AWS output feeds a Cloudflare input
  ttl     = 300
}

resource "github_repository" "infra" {
  name       = "web-infra"
  visibility = "private"
}

Terraform compared with other tools

Tool category Primary job Relationship to Terraform
Cloud-specific IaC (CloudFormation, ARM/Bicep) Provision one vendor's cloud Terraform covers many vendors with one language
Configuration management (Ansible, Chef, Puppet) Configure software inside servers Often complementary: Terraform provisions, then config management configures
Image builders (Packer) Build machine images Pairs with Terraform for immutable deployments