Table: gcp_organization_project - Query Google Cloud Platform Projects using SQL
Note: this table is a variant of the gcp_project
table which does not filter on the GCP project attached to connection, and thus, will return all projects that the credentials used by the connection have access to. Using this table in aggregator connections can produce unexpected duplicate results.
A Google Cloud Platform Project acts as an organizational unit within GCP where resources are allocated. It is used to group resources that belong to the same logical application or business unit. Each project is linked to a billing account and can have users, roles, and permissions assigned to it.
Table Usage Guide
The gcp_organization_project
table provides insights into Projects within Google Cloud Platform. As a DevOps engineer, explore project-specific details through this table, including ID, name, labels, and lifecycle state. Utilize it to uncover information about projects, such as their associated resources, user roles, permissions, and billing details.
Examples
Basic info
Explore which Google Cloud Platform projects are active, by looking at their lifecycle state and creation time. This can help you manage resources effectively and keep track of ongoing projects.
select name, project_id, project_number, lifecycle_state, create_timefrom gcp_organization_project;
select name, project_id, project_number, lifecycle_state, create_timefrom gcp_organization_project;
Get access approval settings for all projects
Explore the access approval settings across your various projects. This can help you understand and manage permissions and approvals more effectively.
select name, jsonb_pretty(access_approval_settings) as access_approval_settingsfrom gcp_organization_project;
select name, access_approval_settingsfrom gcp_organization_project;
Get parent and organization ID for all projects
Get the organization ID across your various projects.
select project_id, parent ->> 'id' as parent_id, parent ->> 'type' as parent_type, case when jsonb_array_length(ancestors) > 1 then ancestors -> -1 -> 'resourceId' ->> 'id' else null end as organization_idfrom gcp_project;
select project_id, parent ->> 'id' as parent_id, parent ->> 'type' as parent_type, case when json_array_length(ancestors) > 1 then ancestors -> -1 -> 'resourceId' ->> 'id' else null end as organization_idfrom gcp_project;
Schema for gcp_organization_project
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
access_approval_settings | jsonb | The access approval settings associated with this project. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
ancestors | jsonb | The ancestors of the project in the resource hierarchy, from bottom to top. | |
billing_information | jsonb | The billing information of the project. | |
create_time | timestamp with time zone | Creation time of the project. | |
labels | jsonb | A list of labels attached to this project. | |
lifecycle_state | text | Specifies the project lifecycle state. | |
name | text | The name of the project. | |
parent | jsonb | An optional reference to a parent Resource. | |
project_id | text | An unique, user-assigned ID of the Project. | |
project_number | bigint | The number uniquely identifying the project. | |
self_link | text | Server-defined URL for the resource. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tags | jsonb | A map of tags for the resource. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp
You can pass the configuration to the command with the --config
argument:
steampipe_export_gcp --config '<your_config>' gcp_organization_project