Part 2: Services & APIs: Building a Reliable Inventory Baseline
AuthorEmmanuel Secretaria
Published Aug 9, 2025
Learn how to enumerate enabled APIs and interpret the service footprint that powers each GCP environment.
Scope inspiration:** gcp_info.sh, gcp_info_services.sh, gcp_service_apis.sh.
This series follows the repo’s GCP inventory flow so every step builds a repeatable, audit-friendly picture of your environment. Part 2 locks down the Services & APIs layer so you only query what’s actually enabled.
What this script does (walkthrough)
The services inventory is the gating step for the rest of the discovery flow. The scripts deliberately build a list of enabled APIs first and then use that list to avoid noisy failures later.
- Generate a service catalog via
(if not already loaded).gcp_service_apis.sh - List enabled services with
so the report reflects actual API usage.gcloud services list --enabled - Feed the enabled list to downstream sections, letting
guard feature-specific calls.is_service_enabled
Operational caveats and gotchas
- The script explicitly hydrates the service list only once. If you toggle APIs mid-session, you should re-run the script to refresh the baseline.
assumes your project is already set (Part 1), because it uses the current project to determine which APIs are enabled.gcp_info_services.sh- Output is intentionally lean: the goal is a baseline inventory, not a full per-service deep dive.
Example command usage
# Enumerate enabled APIs for the active project gcp/gcp_info_services.sh
# Force a specific project to scope the services list CLOUDSDK_CORE_PROJECT=my-project-id gcp/gcp_info_services.sh