turbot/gcp

steampipe plugin install gcpsteampipe plugin install gcp
gcp_audit_policygcp_bigquery_datasetgcp_bigquery_jobgcp_bigquery_tablegcp_bigtable_instancegcp_cloudfunctions_functiongcp_compute_addressgcp_compute_backend_bucketgcp_compute_backend_servicegcp_compute_diskgcp_compute_disk_metric_read_opsgcp_compute_disk_metric_read_ops_dailygcp_compute_disk_metric_read_ops_hourlygcp_compute_disk_metric_write_opsgcp_compute_disk_metric_write_ops_dailygcp_compute_disk_metric_write_ops_hourlygcp_compute_firewallgcp_compute_forwarding_rulegcp_compute_global_addressgcp_compute_global_forwarding_rulegcp_compute_imagegcp_compute_instancegcp_compute_instance_metric_cpu_utilizationgcp_compute_instance_metric_cpu_utilization_dailygcp_compute_instance_metric_cpu_utilization_hourlygcp_compute_instance_templategcp_compute_machine_typegcp_compute_networkgcp_compute_node_groupgcp_compute_node_templategcp_compute_project_metadatagcp_compute_regiongcp_compute_resource_policygcp_compute_routergcp_compute_snapshotgcp_compute_ssl_policygcp_compute_subnetworkgcp_compute_target_https_proxygcp_compute_target_poolgcp_compute_target_ssl_proxygcp_compute_target_vpn_gatewaygcp_compute_url_mapgcp_compute_vpn_tunnelgcp_compute_zonegcp_dns_managed_zonegcp_dns_policygcp_dns_record_setgcp_iam_policygcp_iam_rolegcp_kms_keygcp_kms_key_ringgcp_logging_bucketgcp_logging_exclusiongcp_logging_metricgcp_logging_sinkgcp_monitoring_alert_policygcp_monitoring_groupgcp_monitoring_notification_channelgcp_organizationgcp_projectgcp_project_organization_policygcp_project_servicegcp_pubsub_snapshotgcp_pubsub_subscriptiongcp_pubsub_topicgcp_service_accountgcp_service_account_keygcp_sql_backupgcp_sql_databasegcp_sql_database_instancegcp_sql_database_instance_metric_connectionsgcp_sql_database_instance_metric_connections_dailygcp_sql_database_instance_metric_connections_hourlygcp_sql_database_instance_metric_cpu_utilizationgcp_sql_database_instance_metric_cpu_utilization_dailygcp_sql_database_instance_metric_cpu_utilization_hourlygcp_storage_bucket

Table: gcp_cloudfunctions_function

Google Cloud Functions is a serverless execution environment for building and connecting cloud services. With Cloud Functions you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services.

Examples

Basic function info

select
name,
description,
status,
runtime,
available_memory_mb,
max_instances,
ingress_settings,
timeout
from
gcp_cloudfunctions_function;

Count of cloud functions by runtime engines

select
runtime,
count(*)
from
gcp_cloudfunctions_function
group by
runtime;

Cloud functions service account info

select
f.name as function_name,
f.service_account_email as service_account_email,
a.display_name as service_account_display_name
from
gcp_cloudfunctions_function as f,
gcp_service_account as a
where
f.service_account_email = a.email

Cloud functions service account info, including roles assigned in the project IAM policy

select
f.name as function_name,
f.service_account_email as service_account_email,
a.display_name as service_account_display_name,
b ->> 'role' as role_name
from
gcp_cloudfunctions_function as f,
gcp_service_account as a,
gcp_iam_policy as p,
jsonb_array_elements(bindings) as b,
jsonb_array_elements_text(b -> 'members') as m
where
f.service_account_email = a.email
and m = ( 'serviceAccount:' || f.service_account_email)

View the resource-level IAM policy on cloud functions

select
name,
jsonb_pretty(iam_policy)
from
gcp_cloudfunctions_function;

Find members assigned in resource-level IAM policy on cloud functions that are not in your email domain

select
name,
b ->> 'role' as role_name,
m as member
from
gcp_cloudfunctions_function,
jsonb_array_elements(iam_policy -> 'bindings') as b,
jsonb_array_elements_text(b -> 'members') as m
where
m not like '%@turbot.com'

.inspect gcp_cloudfunctions_function

GCP Cloud Function

NameTypeDescription
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
available_memory_mbbigintThe amount of memory in MB available for the function.
build_environment_variablesjsonbEnvironment variables that shall be available during build time
build_idtextThe Cloud Build ID of the latest successful deployment of the function.
descriptiontextUser-provided description of a function.
entry_pointtextThe name of the function (as defined in source code) that will be executed.
environment_variablesjsonbEnvironment variables that shall be available during function execution.
event_triggerjsonbA source that fires events in response to a condition in another service.
https_triggerjsonbAn HTTPS endpoint type of source that can be triggered via URL.
iam_policyjsonbThe IAM policy for the function.
ingress_settingstextThe ingress settings for the function, controlling what traffic can reach it (INGRESS_SETTINGS_UNSPECIFIED, ALLOW_ALL, ALLOW_INTERNAL_ONLY, ALLOW_INTERNAL_AND_GCLB).
labelsjsonbLabels that apply to this function.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
max_instancesbigintThe limit on the maximum number of function instances that may coexist at a given time. In some cases, such as rapid traffic surges, Cloud Functions may, for a short period of time, create more instances than the specified max instances limit.
nametextThe name of the function.
networktextThe VPC Network that this cloud function can connect to.
projecttextThe GCP Project in which the resource is located.
runtimetextThe runtime in which to run the function.
service_account_emailtextThe email of the function's service account.
source_archive_urltextThe Google Cloud Storage URL, starting with gs://, pointing to the zip archive which contains the function.
source_repositorytext**Beta Feature** The source repository where a function is hosted.
source_upload_urltextThe Google Cloud Storage signed URL used for source uploading, generated by google.cloud.functions.v1.GenerateUploadUrl
statustextStatus of the function deployment (ACTIVE, OFFLINE, CLOUD_FUNCTION_STATUS_UNSPECIFIED,DEPLOY_IN_PROGRESS, DELETE_IN_PROGRESS, UNKNOWN).
tagsjsonbA map of tags for the resource.
timeouttextThe function execution timeout. Execution is consideredfailed and can be terminated if the function is not completed at the end of the timeout period. Defaults to 60 seconds.
titletextTitle of the resource.
update_timetimestamp without time zoneThe last update timestamp of the Cloud Function.
version_idbigintThe version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created.
vpc_connectortextThe VPC Network Connector that this cloud function can connect to. This field is mutually exclusive with `network` field and will eventually replace it.
vpc_connector_egress_settingstextThe egress settings for the connector, controlling what traffic is diverted through it (VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED, PRIVATE_RANGES_ONLY, ALL_TRAFFIC).