accounts_by_provideraccounts_by_workspaceaccounts_countaccounts_totalactive_controls_by_workspaceactive_controls_countalerts_totalcache_health_checkcontrols_summaryguardrails_activity_retentionguardrails_control_alarm_countguardrails_control_alarm_total_countguardrails_control_alert_24_hours_countguardrails_control_alert_after_1_yearguardrails_control_alert_between_1_30_daysguardrails_control_alert_between_30_90_daysguardrails_control_alert_between_90_365_daysguardrails_control_alert_oldestguardrails_control_error_24_hours_countguardrails_control_error_after_1_yearguardrails_control_error_between_1_30_daysguardrails_control_error_between_30_90_daysguardrails_control_error_between_90_365_daysguardrails_control_error_countguardrails_control_error_oldestguardrails_control_error_total_countguardrails_control_invalid_24_hours_countguardrails_control_invalid_after_1_yearguardrails_control_invalid_between_1_30_daysguardrails_control_invalid_between_30_90_daysguardrails_control_invalid_between_90_365_daysguardrails_control_invalid_countguardrails_control_invalid_oldestguardrails_control_invalid_total_countguardrails_control_top_20_alertsguardrails_mod_auto_updateguardrails_retentionguardrails_workspace_user_activityinstalled_aws_mods_countinstalled_azure_mods_countinstalled_gcp_mods_countinstalled_mods_by_platformmod_auto_updatemod_health_benchmarkmod_installed_controls_errormod_installed_controls_error_listmod_process_monitor_benchmarkpolicies_summarypolicy_settings_totalresources_by_workspaceresources_countsmart_process_retentionsmart_retentionstacks_aggregatetype_installed_controls_errortype_installed_controls_error_listworkspace_account_detailworkspace_health_controlworkspace_statsworkspaces_count
Query: workspace_account_detail
Usage
powerpipe query guardrails_insights.query.workspace_account_detail
Steampipe Tables
SQL
select accountables -> 'turbot' ->> 'id' as "id", case when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/aws#/resource/types/account' then accountables -> 'data' ->> 'Id' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/azure#/resource/types/subscription' then accountables -> 'data' ->> 'subscriptionId' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/gcp#/resource/types/project' then accountables -> 'data' ->> 'projectId' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/servicenow#/resource/types/instance' then accountables -> 'data' ->> 'instance_id' end as "External ID", case when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/aws#/resource/types/account' then accountables -> 'data' ->> 'AccountAlias' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/azure#/resource/types/subscription' then accountables -> 'data' ->> 'displayName' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/gcp#/resource/types/project' then accountables -> 'data' ->> 'name' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/servicenow#/resource/types/instance' then accountables -> 'data' ->> 'instance_id' end as "Name", case when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/aws#/resource/types/account' then 'AWS' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/azure#/resource/types/subscription' then 'Azure' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/gcp#/resource/types/project' then 'GCP' when accountables -> 'type' ->> 'uri' = 'tmod:@turbot/servicenow#/resource/types/instance' then 'ServiceNow' end as "Provider", workspace as "Workspace", (accountables -> 'descendants' -> 'metadata' -> 'stats' -> 'total')::int as "Resources", (accountables -> 'policySettings' -> 'metadata' -> 'stats' ->> 'total')::int as "Policy Settings", (accountables -> 'alerts' -> 'metadata' -> 'stats' ->> 'total')::int as "Alerts", (accountables -> 'activeControls' -> 'metadata' -> 'stats' ->> 'total')::int as "Active Controls"from guardrails_query, jsonb_array_elements(output -> 'resources' -> 'items') as accountableswhere query = '{ resources( filter: "resourceTypeId:tmod:@turbot/turbot#/resource/interfaces/accountable level:self limit:5000" ) { metadata { stats { total } } items { data turbot { id } type { uri } descendants { metadata { stats { total } } } policySettings { metadata { stats { total } } } alerts: controls(filter: "state:alarm,invalid,error") { metadata { stats { total } } } activeControls: controls(filter: "state:active") { metadata { stats { total } } } } }}'order by "Workspace", "Resources" desc;
Dashboards
The query is used in the dashboards: