turbot/steampipe-mod-terraform-gcp-compliance

Control: Ensure Default Service account is not used at a folder level

Description

This control checks that the Default Service account is not used at a folder level.

Usage

Run the control in your terminal:

powerpipe control run terraform_gcp_compliance.control.iam_folder_use_default_service_role

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_gcp_compliance.control.iam_folder_use_default_service_role --share

SQL

This control uses a named query:

select
address as resource,
case
when ((attributes_std ->> 'members') like any (array ['%@developer.gserviceaccount.com', '%@appspot.gserviceaccount.com']) or (attributes_std ->> 'member') like '%@developer.gserviceaccount.com' or (attributes_std ->> 'member') like '%@appspot.gserviceaccount.com') then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when ((attributes_std ->> 'members') like any (array ['%@developer.gserviceaccount.com', '%@appspot.gserviceaccount.com']) or (attributes_std ->> 'member') like '%@developer.gserviceaccount.com' or (attributes_std ->> 'member') like '%@appspot.gserviceaccount.com') then ' uses default service account role'
else ' does not use default service account role'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type in ('google_folder_iam_member', 'google_folder_iam_binding');

Tags