Control: Ensure that instances are not configured to use the default service account
Description
It is recommended to configure your instance to not use the default Compute Engine service account because it has the Editor role on the project.
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.compute_instance_with_no_default_service_account
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.compute_instance_with_no_default_service_account --share
SQL
This control uses a named query:
select self_link resource, case when name like 'gke-%' and labels ? 'goog-gke-node' then 'skip' when account ->> 'email' like '%-compute@developer.gserviceaccount.com' 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' then title || ' configured to use default service account.' else title || ' not configured with default service account.' end as reason , location as location, project as projectfrom gcp_compute_instance, jsonb_array_elements(service_accounts) account;