turbot/gcp_labels
GitHub
Loading controls...

Control: Dataproc clusters should not exceed label limit

Description

Check if the number of labels on Dataproc clusters do not exceed the limit.

Usage

Run the control in your terminal:

steampipe check gcp_labels.control.dataproc_cluster_label_limit

Snapshot and share results via Steampipe Cloud:

steampipe login
steampipe check --share gcp_labels.control.dataproc_cluster_label_limit

Plugins & Tables

Params

ArgsNameDefaultDescriptionVariable
$1label_limit
60

SQL

with analysis as (
select
self_link,
title,
cardinality(
array(
select
jsonb_object_keys(labels)
)
) as num_label_keys,
location,
project
from
gcp_dataproc_cluster
)
select
self_link as resource,
case
when num_label_keys > $1 :: integer then 'alarm'
else 'ok'
end as status,
title || ' has ' || num_label_keys || ' label(s).' as reason,
location,
project
from
analysis