turbot/gcp_compliance

Query: compute_instance_with_no_default_service_account_with_full_access

Usage

powerpipe query gcp_compliance.query.compute_instance_with_no_default_service_account_with_full_access

Steampipe Tables

SQL

select
self_link resource,
case
when name like 'gke-%'
and labels ? 'goog-gke-node' then 'skip'
when account ->> 'email' like '%-compute@developer.gserviceaccount.com'
and account -> 'scopes' ? 'https://www.googleapis.com/auth/cloud-platform' then 'alarm'
else 'ok'
end as status,
case
when name like 'gke-%'
and labels ? 'goog-gke-node' then title || ' created by GKE.'
when account ->> 'email' like '%-compute@developer.gserviceaccount.com'
and account -> 'scopes' ? 'https://www.googleapis.com/auth/cloud-platform' then title || ' configured with default service account with full access.'
else title || ' not configured with default service account with full access.'
end as reason,
location as location,
project as project
from
gcp_compute_instance,
jsonb_array_elements(service_accounts) account;

Controls

The query is being used by the following controls: