Control: Compute images should have mandatory labels
Description
Check if Compute images have mandatory labels.
Usage
Run the control in your terminal:
powerpipe control run gcp_labels.control.compute_image_mandatorySnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_labels.control.compute_image_mandatory --shareSteampipe Tables
SQL
with analysis as (  select    self_link,    title,    labels ?& $1 as has_mandatory_labels,    to_jsonb($1) - array(select jsonb_object_keys(labels)) as missing_labels,    location,    project  from    gcp_compute_image  where    source_project = project)select  self_link as resource,  case    when has_mandatory_labels then 'ok'    else 'alarm'  end as status,  case    when has_mandatory_labels then title || ' has all mandatory labels.'    else title || ' is missing labels: ' || array_to_string(array(select jsonb_array_elements_text(missing_labels)), ', ') || '.'  end as reason,  location,  projectfrom  analysis
Params
| Args | Name | Default | Description | Variable | 
|---|---|---|---|---|
| $1 | mandatory_labels |  |