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
June 9th, 2023 - Updated instance image
April 27th, 2023 - Updated theia to enable autosave
Environment before
Environment after
Jun is a Cloud Labs Developer with previous experience as a Software Engineer and Cloud Developer. He holds the AWS Certified Solutions Architect and DevOps Engineer Professional certifications. He also holds the AWS Certified Solutions Architect, Developer, and SysOps Administrator Associate certifications.
Jun is focused on giving back to the growing cloud community by sharing his knowledge and experience with students and creating engaging content.