Skip to content

Google Cloud Provider Reference

Source of truth

Definitions live under examples/api-definitions/apis/gcp. Update the API definitions and re-run make docs-reference.

v1

Resource Kind Short Names Categories
artifactregistries ArtifactRegistry gar
cloudfunctions CloudFunction gcf
computeinstances ComputeInstance gce

ArtifactRegistry

  • API Group: gcp/v1\
  • Resource Name: artifactregistries\
  • Kind: ArtifactRegistry

Regional Artifact Registry repositories.

Align Artifact Registry configuration—format, replication, cleanup policies—between teams by documenting them once in the API definitions. Registries can back Docker/OCI images, Maven, npm, or generic artifacts.

Configuration Examples

apiVersion: gcp/v1
kind: ArtifactRegistry
metadata:
  name: shared-images
spec:
  project: sample-project
  location: australia-southeast1
  format: DOCKER
  description: Golden base images
  dockerConfig:
    immutableTags: true
  cleanupPolicyDryRun: false
  cleanupPolicies:
    - id: keep-release
      action: KEEP
      condition:
        tagState: TAGGED
        tagPrefix: release-
        olderThanDays: 60
resource "google_artifact_registry_repository" "shared" {
  repository_id = "shared-images"
  project       = "sample-project"
  location      = "australia-southeast1"
  description   = "Golden base images"
  format        = "DOCKER"

  docker_config {
    immutable_tags = true
  }
}

Required Arguments

Name Type Description
project string GCP project that owns the repository.
location string Region or multi-region location for storage.
format string Repository format such as DOCKER, MAVEN, or NPM.

Optional Arguments

Name Type Description Default
description string Optional human readable summary.
dockerConfig object Block controlling tag immutability and vulnerability scanning.
cleanupPolicies list(object) Policy list that keeps/denies packages by age or tag patterns.
cleanupPolicyDryRun bool When true, reports what would be deleted without removing anything.

Computed Attributes

Name Type Description
repositoryId string Identifier portion of the repository URL.
uri string Artifact Registry endpoint for the repository.

CloudFunction

  • API Group: gcp/v1\
  • Resource Name: cloudfunctions\
  • Kind: CloudFunction

Google Cloud Functions (2nd gen).

The CloudFunction schema models both build- and deploy-time switches for Functions 2nd gen, including build images, service accounts, concurrency, and event triggers. It's ideal when you need to show YAML and HCL equivalents.

Configuration Examples

apiVersion: gcp/v1
kind: CloudFunction
metadata:
  name: gcf-image-processor
spec:
  project: sample-project
  region: us-central1
  runtime: nodejs20
  serviceAccountEmail: gcf-runtime@sample-project.iam.gserviceaccount.com
  buildConfig:
    entryPoint: handler
    environmentVariables:
      NODE_ENV: production
    source:
      storageSource:
        bucket: artifacts-sample-project
        object: functions/image-processor.zip
  serviceConfig:
    availableMemoryMb: 1024
    timeoutSeconds: 60
    minInstanceCount: 0
    maxInstanceCount: 10
  eventTrigger:
    triggerRegion: us-central1
    eventType: google.cloud.storage.object.v1.finalized
    eventFilters:
      - attribute: bucket
        value: raw-images
resource "google_cloudfunctions2_function" "image" {
  name        = "gcf-image-processor"
  project     = "sample-project"
  location    = "us-central1"
  description = "Processes new objects"

  build_config {
    runtime     = "nodejs20"
    entry_point = "handler"
    source {
      storage_source {
        bucket = "artifacts-sample-project"
        object = "functions/image-processor.zip"
      }
    }
  }

  service_config {
    max_instance_count = 10
    min_instance_count = 0
    available_memory   = "1024M"
    timeout_seconds    = 60
    service_account_email = "gcf-runtime@sample-project.iam.gserviceaccount.com"
  }

  event_trigger {
    event_type  = "google.cloud.storage.object.v1.finalized"
    trigger_region = "us-central1"
    event_filters {
      attribute = "bucket"
      value     = "raw-images"
    }
  }
}

Required Arguments

Name Type Description
project string Google Cloud project ID.
region string Region where the function runs.
runtime string Execution runtime such as nodejs20 or python311.

Optional Arguments

Name Type Description Default
serviceAccountEmail string Identity used during execution.
buildConfig object Source bundle, entrypoint, and build environment variables.
serviceConfig object Scaling, timeout, and networking settings for execution.
eventTrigger object Pub/Sub, Eventarc, or Storage trigger configuration.

Computed Attributes

Name Type Description
state string Deployment state reported by Cloud Functions.
updateTime string Timestamp of the latest deploy.

ComputeInstance

  • API Group: gcp/v1\
  • Resource Name: computeinstances\
  • Kind: ComputeInstance

Compute Engine virtual machines.

ComputeInstance resources expose the same knobs Terraform offers for Google Compute Engine, but through babyctl-native YAML. That includes boot disks, attached GPUs, metadata, and network interfaces.

Configuration Examples

apiVersion: gcp/v1
kind: ComputeInstance
metadata:
  name: gce-api-01
spec:
  project: sample-project
  zone: us-central1-a
  machineType: e2-standard-4
  labels:
    env: prod
    service: api
  bootDisk:
    image: projects/debian-cloud/global/images/family/debian-12
    sizeGb: 50
  networkInterfaces:
    - network: default
      subnetwork: default
      accessConfigs:
        - natIP: 34.118.10.10
  metadata:
    startup-script: |
      #!/bin/bash
      apt-get update && apt-get install -y nginx
resource "google_compute_instance" "api" {
  name         = "gce-api-01"
  project      = "sample-project"
  zone         = "us-central1-a"
  machine_type = "e2-standard-4"

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-12"
      size  = 50
    }
  }

  network_interface {
    network    = "default"
    subnetwork = "default"

    access_config {
      nat_ip = "34.118.10.10"
    }
  }

  metadata = {
    startup-script = file("scripts/startup.sh")
  }

  labels = {
    env     = "prod"
    service = "api"
  }
}

Required Arguments

Name Type Description
project string Google Cloud project that owns the instance.
zone string Compute Engine zone such as us-central1-a.
machineType string Machine type defining vCPU and RAM.

Optional Arguments

Name Type Description Default
bootDisk object Boot disk configuration including image family and size.
networkInterfaces list(object) Primary and additional NIC definitions including access configs.
labels map(string) Optional key/value labels for the instance.
metadata map(string) Custom metadata entries; startup-script is supported.

Computed Attributes

Name Type Description
selfLink string Full resource URL for the instance.
networkIPs list(string) Internal IP addresses assigned to NICs.