Terraform GCP
Infrastructure as code for Google Cloud Platform.
Quick Start
provider "google" {
project = "my-project"
region = "us-central1"
}
resource "google_storage_bucket" "data" {
name = "my-data-bucket"
location = "US"
}
When to Use
- GCP resource provisioning
- Multi-cloud infrastructure
- Repeatable environments
- Compliance and policy as code
Step-by-Step
- Install Terraform
- Configure GCP provider
- Write resource definitions
- Run:
terraform apply
Dependencies
terraform init
terraform plan
terraform apply
Examples
resource "google_compute_instance" "app" {
name = "app-server"
machine_type = "e2-medium"
zone = "us-central1-a"
boot_disk {
initialize_params { image = "ubuntu-2204-lts" }
}
}
Resources
Validation
terraform planshows expected changes- Resources create successfully
terraform destroycleans up
Source: ssrjkk/claude-skills — distributed by TomeVault.