library
turbot/gcp_thrifty

Detect & correct compute addresses if unattached

Overview

Compute addresses are a costly resource to maintain, if they are unattached you will be accruing costs without any benefit; therefore unattached compute addresses should be released if not required.

This query trigger detects unattached compute addresses and then either sends a notification or attempts to perform a predefined corrective action.

Getting Started

By default, this trigger is disabled, however it can be configured by setting the below variables

  • compute_addresses_if_unattached_trigger_enabled should be set to true as the default is false.
  • compute_addresses_if_unattached_trigger_schedule should be set to your desired running schedule
  • compute_addresses_if_unattached_default_action should be set to your desired action (i.e. "notify" for notifications or "release" to release the Compute address).

Then starting the server:

flowpipe server

or if you've set the variables in a .fpvars file:

flowpipe server --var-file=/path/to/your.fpvars

Query

select
concat(name, ' [', location, '/', project, ']') as title,
name as address_name,
location,
_ctx ->> 'connection_name' as cred,
project
from
gcp_compute_address
where
status != 'IN_USE';

Schedule

15m