steampipe plugin install gcp

Table: gcp_project - Query Google Cloud Platform Projects using SQL

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_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_time
from
gcp_project;
select
name,
project_id,
project_number,
lifecycle_state,
create_time
from
gcp_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_settings
from
gcp_project;
select
name,
access_approval_settings
from
gcp_project;

Get parent and organization ID for all projects

Get the parent resource and 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_id
from
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_id
from
gcp_project;

Control examples

Schema for gcp_project

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
access_approval_settingsjsonbThe access approval settings associated with this project.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
ancestorsjsonbThe ancestors of the project in the resource hierarchy, from bottom to top.
create_timetimestamp with time zoneCreation time of the project.
labelsjsonbA list of labels attached to this project.
lifecycle_statetextSpecifies the project lifecycle state.
nametextThe name of the project.
parentjsonbAn optional reference to a parent Resource.
project_idtextAn unique, user-assigned ID of the Project.
project_numberbigintThe number uniquely identifying the project.
self_linktextServer-defined URL for the resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
tagsjsonbA map of tags for the resource.
titletextTitle 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_project