turbot/gcp_insights

Query: iam_service_accounts_for_compute_instance

Usage

powerpipe query gcp_insights.query.iam_service_accounts_for_compute_instance

SQL

select
s.name || '/' || s.project as account_name
from
gcp_compute_instance i,
gcp_service_account s,
jsonb_array_elements(service_accounts) as sa
where
sa ->> 'email' = s.email
and i.id = (split_part($1, '/', 1))::bigint
and i.project = split_part($1, '/', 2);