TerraformPilot

DevOps

Terraform for Android Automotive OS: Connected-Car Backends

Provision Android Automotive OS connected-car backends with Terraform: vehicle telemetry, OTA updates, maps APIs, and secure ingestion pipelines.

LLuca Berton1 min read

Android Automotive OS (AAOS) is now in production at most major OEMs (Volvo/Polestar, Renault, GM, Honda, Ford). The car runs Android; the cloud runs telemetry, OTA, maps, and infotainment APIs. Terraform provisions the cloud half — typically on GCP with Pub/Sub, BigQuery, and Cloud Run, plus an MQTT bridge for the car link.

Architecture

#
LayerGCP service
Telemetry ingestIoT Core successor (Cloud IoT migrations → Pub/Sub + Cloud Run)
Hot storeBigtable / Firestore
AnalyticsBigQuery
OTACloud Storage + Cloud Functions
AuthIdentity Platform

Telemetry Pub/Sub Topic

#
resource "google_pubsub_topic" "telemetry" {
  name = "vehicle-telemetry"
 
  message_retention_duration = "604800s" # 7 days
}
 
resource "google_pubsub_subscription" "to_bigquery" {
  name  = "telemetry-to-bq"
  topic = google_pubsub_topic.telemetry.name
 
  bigquery_config {
    table = "${var.project_id}.vehicle.telemetry"
    use_table_schema = true
  }
 
  ack_deadline_seconds = 60
}

OTA Bucket with Versioned Builds

#
resource "google_storage_bucket" "ota" {
  name     = "${var.project_id}-aaos-ota"
  location = "US"
  uniform_bucket_level_access = true
  versioning { enabled = true }
}
 
resource "google_storage_bucket_object" "ota_manifest" {
  name   = "manifests/v${var.fw_version}.json"
  bucket = google_storage_bucket.ota.name
  content = jsonencode({
    version = var.fw_version
    sha256  = var.fw_sha256
    rollout = "canary-5"
  })
}

Vehicle-Side mTLS Endpoint

#
resource "google_cloud_run_v2_service" "ingest" {
  name     = "vehicle-ingest"
  location = "us-central1"
 
  template {
    containers {
      image = var.ingest_image
      ports { container_port = 8080 }
    }
    vpc_access { connector = google_vpc_access_connector.car.id }
  }
}

Best Practices

#
  • Stage OTA: 0% → 5% → 25% → 100% with health-metric kill switches.
  • Encrypt telemetry at rest with CMEK — vehicle data falls under GDPR/CCPA scrutiny.
  • Sign manifests with a dedicated KMS key; vehicle verifies before applying.
  • Region-pin per market to satisfy data residency.
#
#Terraform#Android Automotive#Connected Car#OTA#GCP

Share this article