GCP budget alert fired on spend we never expected - the budget_filter was omitted so it tracked the entire billing...
Fixes GCP budget alerts that fire on spend you did not intend to track. Covers adding a budget_filter to scope the budget to projects, services, or labels, and re-checking alert thresholds. Use when a budget alerts on account-wide spend. Not for threshold math.
TL;DR
Without a budget_filter, a GCP budget watches every dollar on the billing account, including projects and services you never meant to include. Add a filter scoping it to the projects, services, or labels you actually care about, then re-check the thresholds against the scoped spend.
Use this when
- A budget alert fires but your project's spend looks fine.
- The budget was created without any filter and the account holds many projects.
- A shared billing account mixes production, dev, and sandbox spend.
Not for this skill when
- The scoped spend itself is unexpectedly high. That is a real anomaly to investigate.
- Alerts never fire at all. Check the notification channels.
Steps
- Open the budget and confirm the filter section is empty. Verify: the budget's scope shows the whole billing account.
- Add a filter: projects, services, or label key-value pairs that define the intended scope. Verify: the filtered spend history in the budget preview matches your expectation.
- Adjust the budget amount and alert thresholds to the scoped spend, not the account total. Verify: current spend sits comfortably under the first threshold.
- Save and wait one evaluation cycle. Verify: no further alerts fire on out-of-scope spend.
- If other teams share the account, create one budget per scope instead of one global budget. Verify: each budget's alerts map to one owner.
Terraform variant
Add the budget_filter block with projects, services, or labels to the google_billing_budget resource. Verify: terraform plan shows the filter being added.
Compatibility: GCP Billing Budgets, console and Terraform.
Why it happens
The default scope of a budget is the entire billing account. On shared accounts that default silently includes every project, so the first alert is always a surprise about somebody else's spend.
Edge cases / pitfalls
- Label-based filters only catch resources labeled before the spend occurred. Unlabeled historical spend stays out.
- Credits and discounts apply at the account level and can make filtered spend look odd. Check the credit settings on the budget.
- A filter on a project that gets deleted leaves the budget watching nothing. Review filters when projects churn.
- The budget UI preview uses recent history; a brand-new project's spend will not show yet.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_4-CIFdb8FWIeD2mPRbn5wA