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_kubernetes_clustergcp_kubernetes_node_poolgcp_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_compute_instance_template

An instance template is a resource that use to create virtual machine (VM) instances and managed instance groups (MIGs). Instance templates define the machine type, boot disk image or container image, labels, and other instance properties.

Examples

List of c2-standard-4 machine type instance template

select
name,
id,
instance_machine_type
from
gcp_compute_instance_template
where
instance_machine_type = 'c2-standard-4';

Boot Disk info of each instance template

select
name,
id,
disk ->> 'deviceName' as disk_device_name,
disk -> 'initializeParams' ->> 'diskType' as disk_type,
disk -> 'initializeParams' ->> 'diskSizeGb' as disk_size_gb,
split_part(
disk -> 'initializeParams' ->> 'sourceImage',
'/',
5
) as source_image,
disk ->> 'mode' as mode
from
gcp_compute_instance_template,
jsonb_array_elements(instance_disks) as disk;

List of SPECIFIC_RESERVATION Instance type instance template

select
name,
id,
instance_reservation_affinity ->> 'consumeReservationType' as consume_reservation_type
from
gcp_compute_instance_template
where
instance_reservation_affinity ->> 'consumeReservationType' = 'SPECIFIC_RESERVATION';

Network interface info of each instance template

select
name,
id,
i ->> 'name' as name,
split_part(i ->> 'network', '/', 10) as network_name,
p ->> 'name' as access_config_name,
p ->> 'networkTier' as access_config_network_tier,
p ->> 'type' as access_config_type
from
gcp_compute_instance_template,
jsonb_array_elements(instance_network_interfaces) as i,
jsonb_array_elements(i -> 'accessConfigs') as p;

List of instance templates where instance_can_ip_forward is true

select
name,
id,
instance_can_ip_forward
from
gcp_compute_instance_template
where
instance_can_ip_forward;

.inspect gcp_compute_instance_template

GCP Compute Instance Template

NameTypeDescription
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
creation_timestamptimestamp without time zoneThe creation timestamp for this instance template.
descriptiontextAn optional description of this resource.
iddouble precisionA unique identifier for this instance template. The server defines this identifier.
instance_can_ip_forwardbooleanEnables instances created based on these properties to send packets with source IP addresses other than their own and receive packets with destination IP addresses other than their own.
instance_descriptiontextAn optional text description for the instances that are created from these properties.
instance_disksjsonbAn array of disks that are associated with the instances that are created from these properties.
instance_guest_acceleratorsjsonbA list of guest accelerator cards' type and count to use for instances created from these properties.
instance_machine_typetextThe machine type to use for instances that are created from these properties.
instance_metadatajsonbThe metadata key/value pairs to assign to instances that are created from these properties. These pairs can consist of custom metadata or predefined keys.
instance_min_cpu_platformtextMinimum cpu/platform to be used by instances. The instance may be scheduled on the specified or newer cpu/platform. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy Bridge". For more information, read Specifying a Minimum CPU Platform.
instance_network_interfacesjsonbAn array of network access configurations for this interface.
instance_private_ipv6_google_accesstextThe private IPv6 google access type for VMs. If not specified, use INHERIT_FROM_SUBNETWORK as default. Possible values: "ENABLE_BIDIRECTIONAL_ACCESS_TO_GOOGLE", "ENABLE_OUTBOUND_VM_ACCESS_TO_GOOGLE", "INHERIT_FROM_SUBNETWORK"
instance_reservation_affinityjsonbSpecifies the reservations that instances can consume from.
instance_resource_policiesjsonbResource policies (names, not URLs) applied to instances created from these properties.
instance_schedulingjsonbSpecifies the scheduling options for the instances that are created from these properties.
instance_service_accountsjsonbA list of service accounts with specified scopes. Access tokens for these service accounts are available to the instances that are created from these properties.
instance_shielded_instance_configjsonbA set of Shielded Instance options.
instance_tagsjsonbA list of tags to apply to the instances that are created from these properties. The tags identify valid sources or targets for network firewalls.
kindtextThe resource type, which is always compute#instanceTemplate for instance templates.
labelsjsonbLabels to apply to instances that are created from these properties.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
nametextA friendly name that identifies the resource.
projecttextThe GCP Project in which the resource is located.
self_linktextThe server-defined URL for this instance template.
source_instancetextThe URL of the source instance used to create the template.
source_instance_nametextThe URL of the source instance used to create the template.
tagsjsonbA map of tags for the resource.
titletextTitle of the resource.