hands-on lab

Working with Terraform Conditional Expressions in GCP

Intermediate
Up to 30m
241
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.
Lab description

A major benefit of Terraform is the ability to apply decision-making into your cloud infrastructure. The language used to define Terraform configurations, HashiCorp Configuration Language (HCL), offers conditional expressions capable of setting resource configurations dynamically. Pairing Terraform modules with conditional expressions can reduce the amount of code needed to build your cloud infrastructue and allow for reusability.

In this lab, you will learn how to incorporate conditional expressions into your Terraform projects to create resources dynamically.

Learning Objectives

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

  • Conditionally create GCP resources with Terraform conditional expressions

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
  • Terraform Modules

The following lab can be used to fulfill the prerequisites:

Updates

April 27th, 2023 - Updated theia to enable autosave

Environment before

Environment after

About the author
Avatar
Jun Fritz, opens in a new tab
Cloud Labs Developer
Students
39,972
Labs
108
Courses
1
Learning paths
6

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. 

Covered topics
Lab steps
Activating the Google Cloud Platform Service Account
Creating Terraform Resources Dynamically with Conditional Expressions