Loading controls...
Control: Budget alerts should be set for each compartment
Description
Budget alerts should be set for each compartment, including the root compartment, to monitor costs.
Usage
Run the control in your terminal:
powerpipe control run oci_thrifty.control.budget_alert_count
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run oci_thrifty.control.budget_alert_count --share
Steampipe Tables
SQL
with compartment_with_budget as ( select id, 'root' as name, 'ACTIVE' as lifecycle_state, tenant_id, _ctx from oci_identity_tenancy union select id, name, lifecycle_state, tenant_id, _ctx from oci_identity_compartment)select c.id as resource, case when a.alert_rule_count is null then 'alarm' when a.alert_rule_count >= 1 and a.reset_period = 'MONTHLY' then 'ok' else 'alarm' end as status, case when a.alert_rule_count is null then c.name || ' has no scheduled budget.' else a.display_name || ' has scheduled budget with ' || a.reset_period || ' reset period.' end as reason, coalesce(c.name, 'root') as compartmentfrom compartment_with_budget as c left join oci_budget_budget as a on a.targets ? & array [ c.id ]where c.lifecycle_state = 'ACTIVE';