hands-on lab

Working with Terraform Remote State in GCP

Difficulty: Beginner
Duration: Up to 45 minutes
Students: 267
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

Managing infrastructure state is a critical aspect of working with Terraform. As a project or team grows, so will the infrastructure state. With multiple developers accessing these resource configurations at the same time, maintaining the state of the infrastructure becomes the top priority. While there are benefits to using local state, managing your Terraform state from a remote source tends to offer a more secure, long-term solution.

By utilizing remote state, Terraform will store state in a remote source. This remote source can be accessed by members of a team and offer state locking features to avoid conflicts. It also will take advantage of the additional security provided by storage resources such as Google Cloud Storage buckets.

In this lab, you will configure a Terraform project to store and manage state from a remote Google Cloud Storage bucket.

Learning Objectives

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

  • Understand how Terraform stores and manages state from a remote source
  • Configure remote state for a Google Cloud Platform infrastructure

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

June 9th, 2023 - Updated instance image

April 27th, 2023 - Updated theia to enable autosave

Environment before

Environment after

Covered topics

Lab steps

Activating the Google Cloud Platform Service Account
Configuring Terraform Remote State in GCP