Google Cloud Platform (GCP) provides tons of services like storage, compute, databases, etc.. and it's a mess to go through all of them.
Terraform is a IAC (infrastructure as code) tool, so you write config (similar to Dockerfile for example), and define what services you need, so it creates that service on your account.
Using them together is a superpower, Terraform works with major providers like Azure, AWS & GCP so anything works.
So let's start with understanding some basic services, later I'll show how to use them in detail, but fundamentals are important.
There's hundreds of services, but I'll go through only the main ones, after that the rest is similar and easy to get used to when needed.
.
GCP Services
1. Compute Engine
Every server, client or any type of machine is a computer. This is the most basic thing you can get, a machine you get access to, where you can run any type of service, just like your local machine.
There's different family such as:
- E2 – cost-effective, good for general workloads.
- N2 / N2D – better performance than E2, with N2D offering AMD CPUs.
- N1 – older generation, still widely used.
- C3 – Newest, highest performance
You don't really need to remember this by the way, just an overview
Depending on your task, you can choose the physical requirements, the memory, CPU cores, disk, etc.. you're in full control.
2. Storage Bucket
Think of it as Google Drive for your backend. Used to store any kind of static assets – images, videos, logs, backups, etc. Fully managed, cheap, and scalable.
You can set permissions, make files public, and connect it to a CDN.
Great for serving assets or storing backups/logs.
3. Cloud Run -> serverless execution
Let’s you run containers without managing any servers. You just give it a Docker image, and it handles the rest – scaling, routing, and more.
Pay-per-use. No traffic? No cost.
Good for APIs, webhooks, or any small backend service.
4.. Firestore -> NoSQL DB
A scalable NoSQL document database. Stores data in collections of documents (like JSON).
Best for quick-moving apps where you don’t need SQL.
What Terraform does?
Initially, you have the cloud console, but using the web console when a lot of services comes to be, its hard to manage.
With terraform you have three steps only:
- Init: Install the provider support (in our case, GCP)
- Plan: Similar to commit in git, mark changes.
- Apply: pretty self-explanatory, no?
Simply by writing config such as:
resource "google_compute_instance" "vm-instance" {
name = "vm-instance-tf"
machine_type = "f1-micro"
zone = "asia-south2-a"
boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-2204-lts"
}
}
network_interface {
network = google_compute_network.vpc_network.name
access_config {}
}
tags = ["allow-web-ssh"]
}
and using this, you can just create a service easily (this is for a compute engine).
Updating, deleting, making changes also becomes very easy.
For now, let's do setup:
- Install terraform tool for your system from here: Install
- Sign-up on GCP console - you can choose to have a 90 days trial where you get $300 credits free.
This was to just get familiar with what is what, I'll show a hands on with compute engine + terraform in the next one!
Top comments (0)