steampipe plugin install turbot

Table: turbot_smart_folder

Smart folders in Turbot allow groups of policies to be applied across a collection of resources.

Examples

List all smart folders

select
id,
title
from
turbot_smart_folder;

List smart folders with their policy settings

select
sf.trunk_title as smart_folder,
pt.trunk_title as policy,
ps.id,
ps.precedence,
ps.is_calculated,
ps.value
from
turbot_smart_folder as sf
left join turbot_policy_setting as ps on ps.resource_id = sf.id
left join turbot_policy_type as pt on pt.id = ps.policy_type_id
order by
smart_folder;

List smart folders with their attached resources

Get each smart folder with an array of the resources attached to it:

select
title,
attached_resource_ids
from
turbot_smart_folder
order by
title;

Create a row per smart folder and resource:

select
sf.title as smart_folder,
sf_resource_id
from
turbot_smart_folder as sf,
jsonb_array_elements(sf.attached_resource_ids) as sf_resource_id
order by
smart_folder,
sf_resource_id;

Unfortunately, this query to join the smart folder with its resources does not work yet due to issues with qualifier handling in the Steampipe Postgres FDW:

select
sf.title as smart_folder,
r.trunk_title as resource,
r.id
from
turbot_smart_folder as sf
cross join jsonb_array_elements(sf.attached_resource_ids) as sf_resource_id
left join turbot_resource as r on r.id = sf_resource_id :: bigint;

Schema for turbot_smart_folder

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
akasjsonbAKA (also known as) identifiers for the smart folder.
attached_resource_idsjsonb
colortextColor of the smart folder in the UI.
create_timestamptimestamp with time zoneWhen the smart folder was first discovered by Turbot. (It may have been created earlier.)
datajsonbResource data.
descriptiontextDescription of the smart folder.
idbigint=Unique identifier of the smart folder.
metadatajsonbResource custom metadata.
parent_idbigintID for the parent of this smart folder.
pathjsonbHierarchy path with all identifiers of ancestors of the smart folder.
resource_type_idbigintID of the resource type for this smart folder.
resource_type_uritextURI of the resource type for this smart folder.
tagsjsonbTags for the smart folder.
timestamptimestamp with time zoneTimestamp when the smart folder was last modified (created, updated or deleted).
titletextTitle of the smart folder.
trunk_titletextTitle with full path of the smart folder.
update_timestamptimestamp with time zoneWhen the smart folder was last updated in Turbot.
version_idbigintUnique identifier for this version of the smart folder.
workspacetextSpecifies the workspace URL.