Terraform on GCP
Welcome
A practical, first-principles guide to Terraform — what each concept does, how the pieces fit together, when to reach for them, and where the failure modes are. The concepts are universal; Google Cloud is the provider the examples are built on, and the parts that make GCP its own — projects and APIs, IAM, Shared VPC, federation — get the depth they deserve.
About This Course
Terraform has a reputation for being easy to start and hard to run well. Writing a few resources and running apply takes an afternoon. Running it across an organization — many projects, real IAM, shared networking, a state file the whole team depends on — is where most of the real learning lives, and where most tutorials stop.
This course covers both ends. It explains Terraform from first principles, in the order that makes the pieces click on Google Cloud: what Infrastructure as Code actually buys you, the Google provider and the project-plus-API bootstrap nothing works without, then the core workflow, the state file on GCS, the language, modules, and a full chapter on IAM — before the parts of running Terraform in production that bite you: real networking, organizing many projects, CI/CD, testing, and operations.
Every topic follows a consistent structure: what it is, how it works, when to use it, when not to, the common mistakes that cost people real outages and money, and the best practices. Where two approaches compete — count versus for_each, workspaces versus projects, an additive IAM member versus an authoritative binding — the course compares them and says when each one fits rather than leaving that work to you.
Who This Is For
Engineers who build or operate cloud infrastructure, and those preparing to. A beginner can read it in order to build a mental model from zero. An experienced engineer — including one who already knows AWS and wants the GCP differences spelled out — can jump to a chapter to fill a gap or settle a decision. It assumes you are comfortable on the command line and have used a cloud console, but it does not assume any prior Terraform.
A Note on Terraform, OpenTofu, and Google Cloud
The course teaches HashiCorp Terraform 1.x. In 2023 HashiCorp changed Terraform's license, and the community forked the last open-source version as OpenTofu, now under the Linux Foundation. The two are almost entirely compatible; where they diverge on a feature, the course says so. Everything you learn about the language, state, and workflow applies to both.
Terraform is provider-agnostic — it manages Google Cloud, AWS, Kubernetes, GitHub, and hundreds more through the same language. But every code example has to target something concrete, so this course uses the google provider throughout. The concepts transfer to any provider; GCP is the vehicle that makes the examples real instead of abstract — and the GCP-specific surface, which is genuinely different from other clouds, is treated as a first-class subject rather than glossed over.
What You Should Already Know
- Command-line comfort — running commands, environment variables, editing files in a shell
- A basic feel for a cloud provider — what a virtual machine, a network, and a storage bucket are
- Version control with Git at a basic level — commits, branches, and pull requests
- What an API and a JSON document are, at the level of what they do
- No prior Terraform or Infrastructure-as-Code experience required
How the Course Is Built
The thirteen chapters are ordered so the early ones teach the core and the later ones build on it. Foundations come first, then — unusually, and deliberately — the Google provider, projects, and authentication, because on GCP you cannot create anything until a project exists, its APIs are enabled, and you have credentials. After that come the core workflow, state on GCS, the language, modules, and a dedicated chapter on identity and access, before the chapters on real infrastructure, organizing many projects, collaboration, testing, and production operations.
A running example threads through the whole book: a fictional analytics company called Hatch, which starts as a single serverless data pipeline and grows into a multi-project organization. The early chapters build the pipeline; the later ones build the org around it. A few principles run through every chapter, and they explain why the course is shaped the way it is.
Chapter Map
Disclaimer
This course is an independent educational project created and maintained by Sergey Okinchuk. It is provided for learning and reference purposes only.
No affiliation. This course is not affiliated with, sponsored by, endorsed by, or officially connected to HashiCorp (an IBM company), the OpenTofu project, the Linux Foundation, Google LLC, or any other company or project mentioned. All opinions, interpretations, and recommendations expressed are those of the author.
Trademarks. "Terraform" and "HashiCorp" are trademarks of HashiCorp, an IBM company. "OpenTofu" is a trademark of the Linux Foundation. "Google Cloud", "Google Cloud Platform", and "GCP" are trademarks of Google LLC. All other product names, logos, and brands are the property of their respective owners. Use of these names and marks is for identification and educational purposes only and does not imply any endorsement.
Accuracy and currency. Terraform and the Google provider evolve quickly — the provider ships releases most weeks, and language features, defaults, and command-line flags drift between versions. Facts in this course reflect the author's understanding at the time of writing and may not be current. Always consult the official Terraform documentation and Google provider documentation as the authoritative sources before making operational decisions.
No warranty. This material is provided "as is" without warranty of any kind. Configuration and commands are illustrative, not production-ready, and may incur cost if applied to a real cloud account. The author accepts no liability for any loss or damage arising from reliance on the content.