GCP Entity Providers logo

Backstage GCP Entity Providers Plugin

Created by BackToStage

GCP Entity Providers brings your Google Cloud resources into the Backstage catalog as Resource entities. It is a backend module that discovers Cloud SQL databases, Memorystore Redis instances, and even GCP projects, then keeps them in sync on a schedule. The goal is simple. See your GCP estate inside Backstage in one place.

The plugin reads from one or more projects or from an entire organization. It creates entities with clear metadata and relationships. You can map ownership from labels, link resources to components, and group them under systems using a label in your GCP metadata. You can also set a suffix for names or use project based namespaces to avoid clashes. It supports a dedicated config key that avoids conflicts with the official Backstage GCP module, so you can run both in the same instance.

Typical use cases fit teams running on GCP who want better visibility and context. You can list every Cloud SQL and Redis instance across projects. You can show which service depends on which database, see the owner, and jump to the right place during incidents. Platform teams get a live inventory that is easy to query and reason about inside Backstage. If you already use the official GKE provider, this module complements it by covering databases, caches, and projects.

Installation Instructions

These instructions apply to self-hosted Backstage only.

Install the backend module

Copy
yarn add --cwd packages/backend @backtostage/plugin-catalog-backend-module-gcp

Set up credentials

Create a Google service account with access to list the resources you want to ingest. Store its JSON key file on disk. Point the backend to it with this env var.

Copy
export GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/service-account.json

You can also use impersonated credentials if that fits your setup.

Wire it into the new backend system

Add the module to your backend entry file. Put these imports and backend.add calls in packages/backend/src/index.ts where you create and configure the backend.

Copy
// packages/backend/src/index.ts
import {
  catalogModuleGoogleSQLDatabaseEntityProvider,
  catalogModuleGoogleRedisDatabaseEntityProvider,
  catalogModuleGoogleOrganizationProjectEntityProvider,
} from '@backtostage/plugin-catalog-backend-module-gcp';

// Add one or more providers
backend.add(catalogModuleGoogleSQLDatabaseEntityProvider);
backend.add(catalogModuleGoogleRedisDatabaseEntityProvider);
backend.add(catalogModuleGoogleOrganizationProjectEntityProvider);

You can add only the providers you need. For example only SQL or only Redis.

Copy
// Only Cloud SQL
backend.add(catalogModuleGoogleSQLDatabaseEntityProvider);

// Only Redis
backend.add(catalogModuleGoogleRedisDatabaseEntityProvider);

// Only Projects from an organization
backend.add(catalogModuleGoogleOrganizationProjectEntityProvider);

Configure catalog providers

Use the gcpResources key to avoid conflicts with other GCP catalog modules. The old gcp key still works but is deprecated.

Example with a single project and both SQL and Redis. This also sets labels for owner component and system.

Copy
# app-config.yaml
catalog:
  providers:
    gcpResources:
      - project: my-gcp-project-id
        ownerLabel: team
        componentLabel: app
        systemLabel: system
        cloudsql:
          resourceType: CloudSQL
          suffix: cloudsql
          disabled: false
          namespaceByProject: false
        redis:
          resourceType: Memorystore Redis
          location: us-central1
          suffix: redis
          disabled: false
          namespaceByProject: false
        schedule:
          frequency: { minutes: 30 }
          timeout: { minutes: 3 }

Example that loads projects from an organization. The project list step runs through the Google API query. Then resources can be ingested based on those projects.

Copy
# app-config.yaml
catalog:
  providers:
    gcpResources:
      - organization:
          query: parent:organizations/1234567890
          resourceType: Project
        schedule:
          frequency: { minutes: 30 }
          timeout: { minutes: 3 }

Optional settings you can use in the entries above

  • ownerLabel default is owner
  • componentLabel default is component
  • systemLabel default is system
  • cloudsql suffix default is cloudsql
  • redis suffix default is redis
  • redis location can be a region or left empty to scan all regions
  • disabled default is false for each provider
  • namespaceByProject default is false for each provider

When you enable namespaceByProject the plugin does not remove resources that already exist in the default namespace. Clean those if you want to avoid duplicates.

You can also fine tune the schedule with initialDelay and scope. These use the same shapes as the Backstage task schedule.

Copy
schedule:
  frequency: { minutes: 30 }
  timeout: { minutes: 3 }
  initialDelay: { seconds: 10 }
  scope: global

If you must use the deprecated key this is the equivalent shape. Prefer gcpResources.

Copy
catalog:
  providers:
    gcp:
      - project: my-gcp-project-id
        schedule:
          frequency: { minutes: 30 }
          timeout: { minutes: 3 }

What appears in the catalog

This module creates Resource entities for Cloud SQL and Redis. It can also create Project entities from your organization search. The owner field can come from your chosen label. The dependency and system fields can come from the component and system labels.

Frontend changes

No frontend additions are needed. The entities will show up in the Catalog pages once the backend ingests them.

Old backend system

This package is built as a backend module for the new backend system. It does not document a legacy CatalogBuilder integration. If your app still uses the old backend, move the catalog to the new backend module loader then add the providers as shown earlier.

Changelog

This changelog is produced from commits made to the GCP Entity Providers plugin since a year ago, and based on the code located here. It may not contain information about all commits. Releases and version bumps are intentionally omitted. This changelog is generated by AI.

Breaking changes

  • Always set DEFAULT_NAMESPACE for owners and components when missing. This can change entity refs in your catalog. Update references if you relied on implicit namespaces #225 #226 merged 11 months ago

Features

  • Support mapping to System using the systemLabel config. This sets spec.system from a label #254 merged 5 months ago
  • Add option to enable namespace by project. Helps avoid cross project naming clashes #210 merged 12 months ago
  • Add suffix config to append a suffix to generated resource names. Helps avoid name clashes in search and catalog #206 merged 12 months ago
  • Add new configuration key to avoid conflict. Use it to prevent resource collisions in your setup #257 merged 2 months ago

Bug fixes

  • Use DEFAULT_NAMESPACE for owner when none is provided #225 merged 11 months ago
  • Use DEFAULT_NAMESPACE for component when none is provided #226 merged 11 months ago

Maintenance

  • Bump Backstage to 1.35.1 for compatibility with the latest core changes #253 merged 5 months ago

Set up Backstage in minutes with Roadie