Skip to main content

Getting Started with Terraform for Google Cloud

Terraform lets you describe your Google Cloud infrastructure in files, then build and change it by running a few commands. This section explores the Terraform workflow in detail - the purpose of each phase and how it is implemented.

Start with Infrastructure as Code for the why (the exam angle: repeatable, reviewable, drift-free vs clicking in the console); the rest of this section is the hands-on tool that implements it.

How this section is organized

Four arcs, in reading order:

ArcPagesWhat you learn
WhyInfrastructure as CodeThe case for IaC, imperative vs declarative, the GCP IaC tool landscape
OperateEditions, Install & AuthWorkflow & CommandsValidatorSet Terraform up, run the five-phase workflow with init/plan/apply/fmt/destroy, gate applies with policy checks
AuthorLanguage & TermsResourcesInput VariablesOutput ValuesModulesRegistry, CFT & CFFWrite HCL: the building blocks, parameterization, reuse, and where to find pre-built modules
Apply & trackHands-on: Build, Change, DestroyStateDrive a real VM through its lifecycle, then understand the state file that makes it all work

What is Terraform?

Terraform is an open-source Infrastructure as Code (IaC) tool by HashiCorp for provisioning resources - including Google Cloud resources - with declarative configuration files.

Because the infrastructure lives in files, those files can be treated as code: shared among team members, edited, reviewed, and versioned. This lets you build and deploy complex cloud infrastructure by running a few simple commands.

ShareCodeEditReviewVersion
Infrastructure lives in declarative config files, so it can be treated as code - shared across the team, edited, reviewed, and versioned.

Who this course is for

Designed for DevOps Engineers, Cloud Architects, Cloud Engineers, and anyone interested in using Terraform to create and manage their Google Cloud infrastructure. This is a fundamental course covering the basics of Terraform for Google Cloud.

FactsPrerequisites
  • Google Cloud Fundamentals: Core Infrastructure (the required prior course)
  • Basic programming skills
  • Familiarity with using the CLI
  • General familiarity with Google Cloud

What you'll learn

Through a series of videos and hands-on labs, you'll work toward five learning objectives:

#Learning objective
1Define the business need for Infrastructure as Code and the benefits of using it in your environment
2Describe Terraform's features and functionalities
3Use Terraform resource blocks, variables, and output values to create Google Cloud infrastructure resources
4Use Terraform modules to build reusable configuration
5Explain the Terraform state file and its importance