turbot/terraform_gcp_compliance

Query: compute_instance_with_no_default_service_account_with_full_access

Usage

powerpipe query terraform_gcp_compliance.query.compute_instance_with_no_default_service_account_with_full_access

Steampipe Tables

SQL

select
address as resource,
case
when (attributes_std -> 'service_account') is null then 'alarm'
when (attributes_std -> 'service_account' ->> 'email') not like '%-compute@developer.gserviceaccount.com' then 'alarm'
when (attributes_std -> 'service_account' ->> 'email') like '%-compute@developer.gserviceaccount.com'
and (attributes_std -> 'service_account' ->> 'scopes') like '%cloud-platform%' then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (attributes_std -> 'service_account') is null then ' not configured with default service account'
when (attributes_std -> 'service_account' ->> 'email') not like '%-compute@developer.gserviceaccount.com' then ' not configured with default service account'
when (attributes_std -> 'service_account' ->> 'email') like '%-compute@developer.gserviceaccount.com'
and (attributes_std -> 'service_account' ->> 'scopes') like '%cloud-platform%' then ' configured to use default service account with full access'
else ' not configured with default service account with full access'
end || '.' reason,
path || ':' || start_line
from
terraform_resource
where
type = 'google_compute_instance';

Controls

The query is being used by the following controls: