You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
HashiCorp Terraform is the most widely adopted multi-cloud Infrastructure as Code (IaC) tool. On Google Cloud, Terraform uses the Google provider to manage GCP resources declaratively using HashiCorp Configuration Language (HCL). This lesson covers how to use Terraform effectively on GCP, including provider configuration, resource management, state handling, and best practices.
While Cloud Deployment Manager is GCP-native, many teams choose Terraform for its broader ecosystem and multi-cloud capabilities:
| Feature | Deployment Manager | Terraform |
|---|---|---|
| Language | YAML + Jinja2/Python | HCL |
| Cloud support | GCP only | Multi-cloud (GCP, AWS, Azure, etc.) |
| State | Managed by Google | Self-managed (local, GCS, Terraform Cloud) |
| Import | Not supported | Supported (terraform import) |
| Community | Small | Very large |
| Modules | Templates | Terraform Registry + custom modules |
| Drift detection | Limited | terraform plan shows drift |
# main.tf
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.0"
}
}
backend "gcs" {
bucket = "my-terraform-state-bucket"
prefix = "terraform/state"
}
}
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.