Working with Terraform Provisioners in GCP

Lab Steps

Activating the Google Cloud Platform Service Account
Creating Terraform Provisioners in GCP

The hands-on lab is part of this learning path

Ready for the real environment experience?

Time Limit30m


Terraform uses HCL, a declarative language that is great for managing the abundance of cloud resources. This may introduce pain points in automation tasks where procedural languages like PowerShell or Bash perform better.

Terraform provisioners can help with this by automating additional setup or teardown requirements after a resource is created or before it is deleted. Provisioners can be a powerful tool in the Terraform developer's toolbelt, but they do come at a cost.

Incorporating the use of provisioners adds complexity to your deployment and may introduce additional networking or dependency pain points. This is why it is important to be aware of how to use provisioners and understand that they should be used as a last resort when developing a solution.

It is important to note that Terraform provisioners should be used as a last resort when developing your solutions. This lab covers Terraform provisioners and how to configure them, but be aware that the solution provided is for demonstration purposes only. More suitable solutions exist for the desired outcome presented in this lab.

In this lab, you will configure both creation and deletion provisioners and learn how and when Terraform utilizes them during a deployment.

Learning Objectives

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

  • Configure creation-time and destroy-time provisioners in your Terraform deployments

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


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

  • Basic concepts of Google Cloud Platform
Environment before
Environment after
About the Author
Learning paths3

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.