# Title, CIDR ranges, arrow labels and flow steps for the gallery diagram. Use with: # terravision draw --source gcp-saas-multi-tenant.tvg.json --annotate gcp-saas-multi-tenant.annotations.yml format: '0.3' title: Google Cloud multi-tenant SaaS with Identity Platform tenants, pooled AlloyDB and a silo project update: google_compute_subnetwork.services: ip_cidr_range: 10.110.0.0/20 google_compute_subnetwork.psc_endpoints: ip_cidr_range: 10.110.16.0/28 google_project.tenant_acme: label: Silo Project Tenant Acme tv_gcp_logical_group.control_plane: label: SaaS Control Plane google_alloydb_cluster.pooled: label: AlloyDB (row-level security) Pooled google_bigquery_dataset.metering: label: BigQuery Metering google_certificate_manager_certificate.tenant_map: label: Certificate Manager Tenant Map google_cloud_run_v2_service.acme_app: label: Cloud Run Acme App google_cloud_run_v2_service.onboarding: label: Cloud Run Onboarding google_cloud_run_v2_service.pooled_app: label: Cloud Run Pooled App google_cloudbuild_trigger.provision_silo: label: Cloud Build Provision Silo google_compute_backend_service.acme: label: Backend Service Acme google_compute_backend_service.pooled: label: Backend Service Pooled google_compute_forwarding_rule.psc_acme_sql: label: Forwarding Rule Psc Acme Sql google_compute_global_forwarding_rule.https: label: Forwarding Rule Https google_compute_security_policy.edge: label: Cloud Armor Edge google_compute_target_https_proxy.saas: label: HTTPS Proxy Saas google_compute_url_map.saas: label: URL Map Saas google_firestore_database.tenant_registry: label: Firestore Tenant Registry google_identity_platform_tenant.acme: label: Identity Platform Acme google_identity_platform_tenant.pooled: label: Identity Platform Pooled google_kms_crypto_key.acme_cmek: label: Cloud KMS Key Acme Cmek google_kms_key_ring.platform: label: Cloud KMS Platform google_logging_project_sink.saas: label: Log Sink Saas google_pubsub_subscription.usage_to_bigquery: label: Subscription Usage To Bigquery google_pubsub_topic.tenant_signups: label: Pub/Sub Tenant Signups google_pubsub_topic.usage: label: Pub/Sub Usage google_secret_manager_secret.db_credentials: label: Secret Manager Db Credentials google_sql_database_instance.acme: label: Cloud SQL Acme connect: google_compute_url_map.saas: - google_compute_backend_service.acme: Host acme.example.com - google_compute_backend_service.pooled: Host *.app.example.com google_cloud_run_v2_service.onboarding: - google_cloudbuild_trigger.provision_silo: Premium tier flows: Tenant request: description: Users of a pooled and a silo tenant color: '#D93025' steps: - resource: tv_gcp_users_icon.tenant_users -> google_identity_platform_tenant.pooled xlabel: Sign in detail: Each tenant's users sign in to their own Identity Platform tenant - resource: google_certificate_manager_certificate.tenant_map -> google_compute_target_https_proxy.saas xlabel: TLS detail: The HTTPS proxy serves every tenant domain from a Certificate Manager map - resource: google_compute_url_map.saas -> google_compute_backend_service.pooled xlabel: Pooled detail: The URL map sends shared-tier tenants to the pooled service - resource: google_cloud_run_v2_service.pooled_app -> google_firestore_database.tenant_registry xlabel: Tenant detail: which looks up the tenant's tier in the registry - resource: google_cloud_run_v2_service.pooled_app -> google_alloydb_cluster.pooled xlabel: Data detail: and reads its rows from AlloyDB, isolated by row-level security - resource: google_compute_url_map.saas -> google_compute_backend_service.acme xlabel: Silo detail: A premium tenant's host name routes to its own Cloud Run service - resource: google_cloud_run_v2_service.acme_app -> google_compute_forwarding_rule.psc_acme_sql xlabel: Own DB detail: which uses Cloud SQL in the tenant's own project, encrypted with the tenant's key Onboarding and metering: description: A tenant signs up and is billed color: '#188038' steps: - resource: google_cloud_run_v2_service.pooled_app -> google_pubsub_topic.tenant_signups xlabel: Sign up detail: The sign-up page publishes a new tenant - resource: google_pubsub_topic.tenant_signups -> google_cloud_run_v2_service.onboarding xlabel: Onboard detail: The onboarding service takes it - resource: google_cloud_run_v2_service.onboarding -> google_identity_platform_tenant.pooled xlabel: Identity detail: creates the tenant in Identity Platform and registers it - resource: google_cloud_run_v2_service.onboarding -> google_cloudbuild_trigger.provision_silo xlabel: Silo detail: For premium tenants it runs Terraform in Cloud Build to create a silo project - resource: google_pubsub_subscription.usage_to_bigquery -> google_bigquery_dataset.metering xlabel: Meter detail: Both tiers publish usage events, which a BigQuery subscription records for billing