CloudBrain Training Logo

Getting Started with Terraform for Google Cloud

(1 day)

This course provides an introduction to using Terraform for Google Cloud. It enables learners to describe how Terraform can be used to implement infrastructure as a code and to apply some of its key features and functionalities to create and manage Google Cloud infrastructure. Learners will get hands-on practice building Google Cloud resources using Terraform.

Objectives

  • Define the business need for infrastructure as code and the benefits of using it in your environment
  • Explain the features and functionalities of Terraform
  • Use Terraform resources, variables, and output values to create Google Cloud infrastructure resources
  • Use Terraform modules to build reusable configurations
  • Explain Terraform state and its importance

Audience

  • Cloud engineers, DevOps engineers, and individuals who want to start using Terraform to automate infrastructure provisioning with a focus on Google Cloud

Prerequisites

To get the most out of this course, participants should:

  • Complete Google Cloud Fundamentals: Core Infrastructure
  • Have basic programming skills and familiarity with using CLI
  • Have general familiarity with Google Cloud

Course Outline

Module 1: Introduction to Terraform for Google Cloud

  • Introduction to IaC
    • What Is infrastructure as Code (IaC)?
    • Problems IaC Can Solve
    • Benefits of IaC
    • Provisioning Versus Configuration
    • Imperative Versus Declarative Approach
  • Introduction to Terraform
    • Terraform Overview
    • Terraform Features
    • IaC Configuration Workflow
    • Terraform Use Cases
  • Using Terraform
    • How to Use Terraform
    • Running Terraform in Production
    • Installing Terraform
    • Authentication for Google Cloud

Module​ ​​2:​​ Terms and Concepts

  • The Author Phase
    • Terraform Directory Structure
    • Introduction to HCL Syntax
    • Resources
    • Variables
    • State
    • Modules
  • Terraform Commands
    • terraform init
    • terraform plan
    • terraform apply
    • terraform fmt
    • terraform destroy
  • Terraform Validator Tool
    • Introduction
    • Why Use the Terraform Validator Tool?
    • Validation Workflow
    • Terraform Validator Use Cases

Module​ ​​3:​​ ​Writing Infrastructure Code for Google Cloud

  • Introduction to Resources
    • Resources Overview
    • Syntax
    • Example
    • Refer a Resource Attribute
  • Considerations to Define a Resource Block
  • Meta-Arguments for Resources
  • Resource Dependencies
    • Implicit Dependency
    • Explicit Dependency
  • Introduction to Variables
    • Overview
    • Syntax to Declare a Variable
    • Syntax to Reference and Assign a Value to a Variable
    • Variables Best Practices
  • Introduction to Output Values
    • Output Values Overview
    • Best Practices
  • Terraform Registry and CFT
    • Introduction to Terraform Registry
    • Introduction to CFT

Module​ ​​4:​​ Organizing and Reusing Configuration with Terraform Modules

  • Introduction to Podules:
    • Why Are Modules Needed?
    • What Is a Module?
    • Example
  • Reusing Configurations by Using Modules
    • Module Sources
    • Calling a Module into the Source Configuration
  • Using Variables to Parameterize Your Configuration
  • Pass Resource Attributes Using Output Variables
  • Module Use Cases, Benefits, and Best Practices

Module​ ​​5:​​ Introduction to Terraform State

  • Introduction to Terraform State
    • How Information Is Stored in a Terraform State File
  • Ways to Save a State File
  • Storing a State File in a Cloud Storage Bucket
    • Issues when Storing the Terraform State Locally
    • Benefits of Storing a State File in a Cloud Storage Bucket
    • Process of Storing a Terraform State File Remotely in a Cloud Storage Bucket
  • Terraform State Best Practices