turbot/aws_tags
Loading controls...

Control: SageMaker training jobs should have mandatory tags

Description

Check if SageMaker training jobs have mandatory tags.

Usage

Run the control in your terminal:

powerpipe control run aws_tags.control.sagemaker_training_job_mandatory

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_tags.control.sagemaker_training_job_mandatory --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1mandatory_tags
["Environment","Owner"]

SQL

with analysis as (
select
arn,
title,
tags ? & $1 as has_mandatory_tags,
to_jsonb($1) - array(
select
jsonb_object_keys(tags)
) as missing_tags,
region,
account_id,
tags,
_ctx
from
aws_sagemaker_training_job
)
select
arn as resource,
case
when has_mandatory_tags then 'ok'
else 'alarm'
end as status,
case
when has_mandatory_tags then title || ' has all mandatory tags.'
else title || ' is missing tags: ' || array_to_string(
array(
select
jsonb_array_elements_text(missing_tags)
),
', '
) || '.'
end as reason,
account_id
from
analysis;