Control: Ensure that Service Account has no admin privileges
Description
This control checks that Service Account has no admin privileges.
Usage
Run the control in your terminal:
powerpipe control run terraform_gcp_compliance.control.iam_service_account_no_admin_priviledge
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_gcp_compliance.control.iam_service_account_no_admin_priviledge --share
SQL
This control uses a named query:
select address as resource, case when (attributes_std ->> 'member') like '%.iam.gserviceaccount.com$' and (attributes_std ->> 'role') like any (array ['roles/Admin', 'roles/admin', 'roles/owner', 'roles/editor']) then 'alarm' else 'ok' end status, split_part(address, '.', 2) || case when (attributes_std ->> 'member') like '%.iam.gserviceaccount.com$' and (attributes_std ->> 'role') like any (array ['roles/Admin', 'roles/admin', 'roles/owner', 'roles/editor']) then ' has admin privileges' else ' does not have admin privileges' end || '.' reason , path || ':' || start_linefrom terraform_resourcewhere type = 'google_project_iam_member';