turbot/digitalocean_thrifty

Control: Droplet snapshots created over 90 days ago should be deleted if not required

Description

Old droplet snapshots are likely unneeded and costly to maintain.

Usage

Run the control in your terminal:

powerpipe control run digitalocean_thrifty.control.droplet_snapshot_age_90

Snapshot and share results via Turbot Pipes:

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

Steampipe Tables

Params

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

SQL

select
a.id as resource,
case
when a.created_at > (current_timestamp - ($1::int || ' days')::interval) then 'ok'
else 'alarm'
end as status,
a.title || ' has been created for ' || date_part('day', now() - created_at) || ' day(s).' as reason
, r.name as region
from
digitalocean_snapshot a,
jsonb_array_elements_text(regions) as region
left join digitalocean_region as r on r.slug = region;

Tags