turbot/digitalocean_thrifty

Control: Droplets created over 90 days ago should be reviewed

Description

Droplets created over 90 days ago should be reviewed and deleted if not required.

Usage

Run the control in your terminal:

powerpipe control run digitalocean_thrifty.control.droplet_long_running

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run digitalocean_thrifty.control.droplet_long_running --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1droplet_age_max_days
90
The maximum number of days droplets are allowed to run.

SQL

select
d.urn as resource,
case
when date_part('day', now() - d.created_at) > $1 and status = 'off' then 'alarm'
when date_part('day', now() - d.created_at) > $1 then 'info'
else 'ok'
end as status,
case
when date_part('day', now() - d.created_at) > 90 and d.status = 'off'
then d.title || ' instance status is ' || d.status || ', has been launced for ' || date_part('day', now() - created_at) || ' day(s).'
else d.title || ' has been launced for ' || date_part('day', now() - d.created_at) || ' day(s).'
end as reason
, r.name as region
from
digitalocean_droplet as d
left join digitalocean_region as r on r.slug = d.region_slug;

Tags