Back to portfolio
Case study · Infrastructure as code

Production-grade GKE with Terraform and a Shared VPC

Taking a hand-provisioned GKE estate to 100% infrastructure as code: a Shared VPC, private clusters, an 8-phase rollout and the guardrails that stop a stray destroy. Plus the open-source landing zones I built for GCP, AWS and Azure on the same pattern.

By Vitor Schiavo Updated October 2026 ~8 min read

Picture a GKE estate and the network under it, all provisioned by hand. No infrastructure as code, no consistent story across environments, and nothing stopping a stray terraform destroy from taking out the shared network. This is a write-up of rebuilding that into a Shared VPC, private clusters, a modular Terraform codebase, and an eight-phase rollout that never left the system half-managed.

Everything here is the technique, with no internal names or specifics. At the end I link the open-source landing zones I built for GCP, AWS and Azure, so you can read the actual code behind the same pattern.

The starting point

Clusters and network were created through the console and a monolithic, copy-pasted Terraform file. There was no reusable module, no per-environment strategy, and no prevent_destroy on the network. In other words, the one resource you cannot casually recreate, the VPC, was the least protected thing in the project.

The target architecture

The rollout, in eight phases

The point of phasing it was to never have a window where the network was half-managed. Each phase left the system in a working state.

The guardrail that matters most

A prevent_destroy lifecycle block on the VPC, subnets and Cloud NAT makes an accidental terraform destroy of the network fail instead of succeed. The network is the one thing you cannot casually recreate, so it is the one thing that should refuse to be deleted. It costs three lines and has saved real outages.

100%infrastructure as code
4GKE clusters, one pipeline
0public node IPs
3open-source landing zones

Results

The same pattern, as open source

The write-up above stays generic, so here is the same pattern as code you can actually read. I built a landing zone for each major cloud: a Terraform plus GitHub Actions setup for multi-environment Kubernetes, with the security defaults baked in (remote state, no secrets in the repo, least-privilege IAM, a prominent security notice in each README).

What I would tell someone starting this