hands-on lab

Understanding Terraform State with GCP

Difficulty: Beginner
Duration: Up to 45 minutes
Students: 289
Rating: 5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

Terraform state acts as a map between your cloud resources and their configurations. This state can be stored locally or remotely depending on the size of your project or team. Local state allows individuals and small teams to manage the resources that make up the infrastructure by providing a consistent representation of each resource and its current configuration.

Terraform state also provides a performance benefit by deploying only the necessary updates to your resources. Storing metadata such as resource dependencies keeps your infrastructure consistent and avoids deployment ordering issues.

Local state is managed by a default Terraform state file, which acts as the single source of truth for your cloud infrastructure.

In this lab, you will explore the declarative nature of Terraform state and the state configuration file. This lab will focus on local state and leave the topic of remote state for another lab.

Learning Objectives

Upon completion of this lab, you will be able to:

  • Understand Terraform local state and the patterns involved in managing GCP infrastructure state
  • Discover potential security risks of maintaining state locally

Intended Audience

  • Individuals looking to pass the HashiCorp Certified: Terraform Associate Exam
  • Individuals and teams seeking an introduction to using Terraform with Google Cloud Platform

Prerequisites

Familiarity with the following will be beneficial but is not required:

  • Basic concepts of Google Cloud Platform

Updates

July 8th, 2024 - Updated instance image

April 27th, 2023 - Updated theia to enable autosave

November 22nd, 2022 - Updated instructions to use debian-10 replacing debian-9

 

 

Environment before

Environment after

Covered topics

Lab steps

Activating the Google Cloud Platform Service Account
Exploring Terraform State with GCP