A simple command-line utility to display Google Cloud Platform project information.
This tool fetches and prints the following GCP information for a specified project ID passed as a command-line argument:
- Google Cloud Project ID (this will be the ID you provide)
- Google Cloud Project Number (fetched based on the provided Project ID)
- Google Cloud Region Name
Region information is determined first by checking a project-specific location label (cloud.googleapis.com/location) on the provided project; if not found or empty, it falls back to the local gcloud default compute region.
Before using this tool, you must have the Google Cloud SDK (gcloud) installed and configured on your system. This means you should be authenticated:
gcloud auth login
gcloud auth application-default loginAnd ideally, have a default project and region configured:
gcloud config set project YOUR_PROJECT_ID
gcloud config set compute/region YOUR_REGIONThe tool relies on gcloud to source this information. If gcloud is not found, the tool will output "N/A" for the respective fields and print errors to stderr.
Additionally, the authenticated gcloud user must have the necessary IAM permissions (e.g., resourcemanager.projects.get) to describe the project ID you provide.
- Download the appropriate binary for your system (Linux or macOS) from the GitHub Releases page for this repository.
- Make the binary executable:
chmod +x ./gcp_info-linux-amd64(or the binary you downloaded). - Run the tool, providing the target project ID as an argument:
./gcp_info-linux-amd64 your-project-id-here
Expected output:
google_cloud_project: your-project-id-here
google_cloud_project_number: 123456789012
google_cloud_region_name: us-central1
If any value cannot be determined, it will show N/A.
- Clone the repository:
git clone <repository_clone_url> # Replace with actual repository clone URL cd <repository_directory_name> # Replace with actual repository directory name
- Build the tool:
This will create an executable named
go build ./gcp_info.go
gcp_info(orgcp_info.exeon Windows) in the current directory. - Run the built tool, providing the target project ID as an argument:
./gcp_info your-project-id-here
Pre-compiled binaries for Linux (amd64) and macOS (amd64, arm64) are automatically generated and attached to GitHub Releases whenever a new version tag (e.g., v1.0.0, v1.1.0-beta.1) is pushed to the repository.
Contributions are welcome! Please feel free to open an issue to discuss a new feature or bug, or submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.