Skip to content

Google Cloud Platform (GCP)

Clanker supports querying GCP infrastructure using the gcloud CLI. Queries are routed to GCP either by an explicit flag or by automatic keyword detection.


Authentication

GCP authentication uses the gcloud CLI and its standard credential chain.

Setting up authentication

bash
# Login to GCP
gcloud auth login

# Set the default project
gcloud config set project your-project-id

# For the Gemini (Vertex AI) provider, also run:
gcloud auth application-default login

Configuration

Add your GCP project ID to ~/.clanker.yaml:

yaml
infra:
  gcp:
    project_id: your-gcp-project-id

Project ID resolution order

  1. --gcp-project CLI flag
  2. infra.gcp.project_id in the config file
  3. GCP_PROJECT environment variable
  4. GOOGLE_CLOUD_PROJECT environment variable
  5. GCLOUD_PROJECT environment variable

Querying GCP

Explicit flag

bash
clanker ask --gcp "List all Cloud Run services"

Automatic routing

If your question mentions GCP-specific services, Clanker routes to GCP automatically:

bash
clanker ask "What Cloud Run services are deployed?"

Combining with other providers

GCP context can be combined with other providers in a single query:

bash
clanker ask --gcp --terraform "Compare Terraform state with actual GCP resources"

Supported Services

Clanker queries GCP services through the gcloud CLI. Commonly queried services include:

  • Compute Engine (instances, instance groups)
  • Cloud Run (services, jobs, revisions, worker pools, domain mappings, multi-region services)
  • Google Kubernetes Engine (GKE clusters)
  • Cloud Storage (buckets)
  • Cloud SQL, AlloyDB, BigQuery, Spanner, Bigtable, Memorystore Redis and Memcached
  • Cloud Functions Gen 1 and Gen 2
  • Pub/Sub (topics, subscriptions)
  • VPC networking, load balancers, Cloud Armor, Cloud DNS, API Gateway
  • Workflows, Batch, Vertex AI endpoints and indexes, Firestore, Firebase apps
  • Artifact Registry repositories, packages, and Docker images
  • Cloud Build, Cloud Deploy, Eventarc, Scheduler, Tasks, Secret Manager, Cloud KMS, logging sinks, and alert policies

Direct inventory examples:

bash
clanker gcp list run-worker-pools --project my-project --location us-central1
clanker gcp list vertex-endpoints --project my-project --location us-central1
clanker gcp list eventarc-triggers --project my-project
clanker gcp list api-gateway --project my-project

Maker Pipeline

The maker feature supports GCP infrastructure provisioning:

bash
# Generate a plan
clanker ask --maker --gcp "Create a Cloud Run service called my-api from gcr.io/my-project/my-api:latest"

# Apply the plan
clanker ask --apply --plan-file plan.json

GCP maker plans are output directly without the enrichment step used for AWS plans.


Backend Credentials

For team environments, GCP credentials (including service account JSON) can be stored and retrieved through the Clanker backend:

bash
clanker credentials store gcp
clanker ask --api-key ck_live_abc123 --gcp "List Cloud Run services"