GCP and Azure equivalents

Intermediate · 23 min

Map the AWS patterns to Google Cloud and Azure resources, and learn the rules that change the code: global VPCs on GCP and resource groups on Azure.

Before thisA VPC on AWSProviders and the registry

Anton Putra · 23 min

GCP and Azure equivalents

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Anton PutraReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • The workflow, state, modules and CI are the same on every cloud; only resource names and a few structural rules change.
  • Google VPC networks are global and subnets regional, with firewall rules defined at the network level; set auto_create_subnetworks = false to control subnets.
  • Azure resources live in a resource group, take location and resource_group_name, need an empty features block, and require subscription_id for plan and apply.
  • Use inline subnets or standalone subnet resources on an azurerm virtual network, never both.

The same system, other vocabulary

You have a job where the infrastructure is on Google Cloud or Azure, and every tutorial you have is AWS. The good news is that the Terraform skills transfer completely: the workflow, state, modules, for_each, lifecycle rules and CI are identical. The resource names and a few structural habits are not. A new cloud means learning its nouns and its two or three unusual rules, not relearning Terraform.

This lesson is a translation table plus the rules that bite when you cross over. The provider mechanics themselves, registry, aliases and authentication, are the same everywhere.

The table, checked

I mapped nine concepts from the AWS lessons to the closest GCP and Azure resources, then wrote a small script that fetches each resource’s documentation page from the provider’s GitHub repository, to check the names exist. The mapping is my judgment; the script only proves each page is there:

concept           AWS                       GCP                                               Azure
virtual network   aws_vpc ok                google_compute_network ok                         azurerm_virtual_network ok
subnet            aws_subnet ok             google_compute_subnetwork ok                      azurerm_subnet ok
firewall rules    aws_security_group ok     google_compute_firewall ok                        azurerm_network_security_group ok
NAT               aws_nat_gateway ok        google_compute_router_nat ok                      azurerm_nat_gateway ok
machine template  aws_launch_template ok    google_compute_instance_template ok               azurerm_linux_virtual_machine_scale_set ok
managed group     aws_autoscaling_group ok  google_compute_region_instance_group_manager ok   azurerm_linux_virtual_machine_scale_set ok
load balancer     aws_lb ok                 google_compute_backend_service ok                 azurerm_lb ok
kubernetes        aws_eks_cluster ok        google_container_cluster ok                       azurerm_kubernetes_cluster ok
workload identity aws_iam_role ok           google_service_account ok                         azurerm_user_assigned_identity ok

My first version reported a false “MISSING” for google_service_account, because that provider names some doc files with the google_ prefix and some without. I fixed the script to try both. The versions on 28 November 2026: hashicorp/google 8.12.0 (17 November), hashicorp/azurerm 5.15.0 (24 November) and hashicorp/aws 6.74.0 (23 November).

Two cells deserve a note. The Azure scale set stands in for both the template and the group, since a scale set is one resource, and a GCP managed instance group uses a separate instance template. And “workload identity” is the closest thing to an AWS role for a running service, but each cloud draws it differently: Google’s service accounts and Azure’s managed identities are objects you create, and the permission binding is a separate resource (google_project_iam for GCP, azurerm_role_assignment for Azure).

Rules that change how you write it

Google Cloud. Google’s VPC documentation says VPC networks, with their routes and firewall rules, are global resources, “not associated with any particular region or zone,” and that subnets are regional. So there is no VPC-per-region the way AWS has it, and one network can span regions. Firewall rules are implemented on the VMs themselves, per the same page, and are defined at the network level. In Terraform that looks like:

provider "google" {
  project = "acme-prod"
  region  = "europe-west1"
}

resource "google_compute_network" "main" {
  name                    = "main"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "private" {
  name          = "private-ew1"
  region        = "europe-west1"
  network       = google_compute_network.main.id
  ip_cidr_range = "10.0.10.0/24"
}

Set auto_create_subnetworks = false unless you want Google to create a subnet in every region for you; the provider docs show the attribute in their examples. I wrote this from the provider docs and did not run it.

Azure. Every resource lives in a resource group, and nearly every azurerm resource takes location and resource_group_name. The docs for azurerm_virtual_network show both, copied from the group. The provider also requires an empty features {} block, and subscription_id is required for plan and apply, though not for validate, per the provider docs:

provider "azurerm" {
  features {}
  subscription_id = var.subscription_id
}

resource "azurerm_resource_group" "main" {
  name     = "rg-main"
  location = "West Europe"
}

resource "azurerm_virtual_network" "main" {
  name                = "vnet-main"
  location            = azurerm_resource_group.main.location
  resource_group_name = azurerm_resource_group.main.name
  address_space       = ["10.0.0.0/16"]
}

Also from the provider docs, not run. There is a quirk worth knowing: the azurerm_virtual_network page says Terraform provides both a standalone subnet resource and in-line subnets within the virtual network. Pick one style per network. Mixing them makes the two fight over what the subnets should be.

What stays identical

  • State goes in a gcs or azurerm backend instead of S3. Locking and the “one state per component” rule are the same.
  • CI authentication without stored keys exists on both: workload identity federation on Google Cloud and federated credentials on Azure, the same pattern as OIDC from CI. The trust condition on the token subject is still the security model.
  • Modules exist for each cloud, including community ones for networks and clusters. The same large-module trade-off applies.
  • Cost estimation and policy scanning from the testing group cover all three clouds, as Infracost’s README says for pricing and Checkov’s check IDs include CKV_GCP_* entries, per its plan-scanning docs.

What not to carry over

Do not copy the AWS shape. A GCP design with a VPC per environment per region imitates AWS rather than using Google’s model. An Azure design that creates one resource group per resource works against how Azure groups things by lifecycle. A resource group is the unit you delete, tag and give access to, so put things that live and die together in the same one. Learn what each cloud’s native idea of “environment” is (a project on Google, a subscription on Azure, an account on AWS) and map your Terraform states onto that.

About the video

The embed is Anton Putra’s “How to Create GKE Cluster Using TERRAFORM? (Google Kubernetes Engine & Workload Identity)”, 23 minutes 21 seconds, March 2022. The description I read is mostly his playlist and contact details, so I take its scope from the title: a GKE cluster and workload identity. It is Google Cloud only, and it is from 2022, so check the provider arguments against the current docs, since the Google provider is now at major version 8. Azure is covered by HashiCorp’s “Using Terraform with Azure” in deeper, a 1 hour 14 minute video from September 2024 that, per its description, creates an Azure virtual machine with cloud-init, data sources, variables and outputs. I did not watch either in full. English was judged from the title, description, channel and the English caption track for each.

Where this fits

That completes the roadmap’s real-world patterns, and with them the tour from first configuration to a team pipeline. From here the useful next step is to take one real network, apply the lessons in this group to it, and keep the plan output open the whole time.

Check yourself

  1. 01Why does a Google VPC not need one network per region?

    VPC networks are global resources and only subnets are regional, so one network can span regions.

  2. 02What happens if you mix inline subnets with azurerm_subnet resources on one virtual network?

    The provider docs say the configurations conflict and the subnets are overwritten.

  3. 03What replaces an AWS role for a service on GCP and Azure?

    A service account on Google Cloud and a user-assigned managed identity on Azure, plus a separate binding resource for permissions.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark