<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/we-ran-into-a-real-issue-a-gcp-poc-gke-cloud-sql-kept-running-and-the-bill-crossed-1200-pro-9r2pekeot" -->

---
title: We ran into a real issue.  A GCP PoC (GKE + Cloud SQL)...
description: GCP doesn't offer a native hard spending cap — budget alerts notify but don't act. This guide walks through building an automated billing kill switch using...
canonical: https://daily.dev/posts/we-ran-into-a-real-issue-a-gcp-poc-gke-cloud-sql-kept-running-and-the-bill-crossed-1200-pro-9r2pekeot
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: We ran into a real issue.  A GCP PoC (GKE + Cloud SQL) kept running and the bill crossed $1200.  Problem: Budget alerts only notify — they don’t stop anything.  So we built a Terraform-based billing kill switch.  Curious — how do you control | daily.dev
og:description: GCP doesn't offer a native hard spending cap — budget alerts notify but don't act. This guide walks through building an automated billing kill switch using...
og:url: https://daily.dev/posts/we-ran-into-a-real-issue-a-gcp-poc-gke-cloud-sql-kept-running-and-the-bill-crossed-1200-pro-9r2pekeot
og:image: https://api.daily.dev/og/posts/9r2peKEoT.png
og:image:alt: We ran into a real issue.  A GCP PoC (GKE + Cloud SQL) kept running and the bill crossed $1200.  Problem: Budget alerts only notify — they don’t stop anything.  So we built a Terraform-based billing kill switch.  Curious — how do you control
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# We ran into a real issue.

A GCP PoC (GKE + Cloud SQL) kept running and the bill crossed $1200.

Problem: Budget alerts only notify — they don’t stop anything.

So we built a Terraform-based billing kill switch.

Curious — how do you control

**[Divyansh](https://daily.dev/sources/jmq4qarkte7zpursprrzm)** · [@divyansh30](https://daily.dev/divyansh30) · 0 upvotes · 1 comments

## Summary

GCP doesn't offer a native hard spending cap — budget alerts notify but don't act. This guide walks through building an automated billing kill switch using Terraform, Cloud Functions (Gen 2), Pub/Sub, and Eventarc. When spend crosses a configurable threshold, a Python Cloud Function calls the Cloud Billing API to detach the billing account, stopping all paid services cold. The full stack is ~200 lines of Terraform and ~50 lines of Python, deployable across multiple dev/sandbox projects via tfvars. Key implementation details include IAM setup for billing-account-level permissions, a dry-run mode for safe testing, deduplication of budget threshold rules, and a deliberate no-retry policy. The approach is explicitly recommended only for dev, sandbox, and PoC environments — not production.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.kubeblogs.com/gcp-billing-kill-switch-terraform/>

## Community discussion

Top comments from developers on daily.dev.

**@divyansh30** · 0 upvotes

> Full guide with setup:
>
> [https://www.kubeblogs.com/gcp-billing-kill-switch-terraform/](https://www.kubeblogs.com/gcp-billing-kill-switch-terraform/)

## Similar posts on daily.dev

- [SCPs, RCPs, and a Kill Switch: A Real AWS Organization Setup](https://daily.dev/posts/scps-rcps-and-a-kill-switch-a-real-aws-organization-setup-hbiabc3ec) · AWS Fundamentals · 2 upvotes · 0 comments
- [Google Cloud spend caps now generally available](https://daily.dev/posts/google-cloud-spend-caps-now-generally-available-hbbara0gg) · Google Cloud · 0 upvotes · 0 comments
- [Introducing Firebase spend caps](https://daily.dev/posts/introducing-firebase-spend-caps-iygfnrfcv) · Firebase · 0 upvotes · 0 comments
- [AI Agents with Cloud Credentials Are Outrunning Billing Guardrails Built for Human-Speed Mistakes](https://daily.dev/posts/ai-agents-with-cloud-credentials-are-outrunning-billing-guardrails-built-for-human-speed-mistakes-kg4m43ten) · InfoQ · 1 upvotes · 0 comments

---

Tags: [#gcp](https://daily.dev/tags/gcp), [#terraform](https://daily.dev/tags/terraform), [#finops](https://daily.dev/tags/finops), [#gcp-cloud-functions](https://daily.dev/tags/gcp-cloud-functions)

[View this post on daily.dev](https://daily.dev/posts/we-ran-into-a-real-issue-a-gcp-poc-gke-cloud-sql-kept-running-and-the-bill-crossed-1200-pro-9r2pekeot)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/we-ran-into-a-real-issue-a-gcp-poc-gke-cloud-sql-kept-running-and-the-bill-crossed-1200-pro-9r2pekeot","headline":"We ran into a real issue.\n\nA GCP PoC (GKE + Cloud SQL) kept running and the bill crossed $1200.\n\nProblem: Budget alerts only notify — they don’t stop anything.\n\nSo we built a Terraform-based billing kill switch.\n\nCurious — how do you control","text":"Shared: GCP Billing Kill Switch Terraform (Stop Cloud Costs Fast)","url":"https://daily.dev/posts/we-ran-into-a-real-issue-a-gcp-poc-gke-cloud-sql-kept-running-and-the-bill-crossed-1200-pro-9r2pekeot","datePublished":"2026-03-23T09:12:20.121Z","dateModified":"2026-03-23T09:13:57.184Z","author":{"@type":"Person","name":"Divyansh","url":"https://daily.dev/divyansh30","image":"https://media.daily.dev/image/upload/s--f9lbkpFv--/f_auto/v1744873189/avatars/avatar_JMQ4qarKTe7zPurSPRrzM","description":"Aspiring engineer with an interest in AI, tech and DevOps :)","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":1090}},"image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"sharedContent":{"@type":"WebPage","url":"https://api.daily.dev/r/gJNZ52SlS"},"comment":[{"@type":"Comment","text":"Full guide with setup:\nhttps://www.kubeblogs.com/gcp-billing-kill-switch-terraform/","datePublished":"2026-03-23T09:12:41.098Z","url":"https://daily.dev/posts/9r2peKEoT#c-d8JgJ39cb","author":{"@type":"Person","name":"Divyansh","url":"https://daily.dev/divyansh30","image":"https://media.daily.dev/image/upload/s--f9lbkpFv--/f_auto/v1744873189/avatars/avatar_JMQ4qarKTe7zPurSPRrzM"}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/jmq4qarkte7zpursprrzm","name":"Divyansh"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Divyansh","item":"https://daily.dev/sources/jmq4qarkte7zpursprrzm"},{"@type":"ListItem","position":3,"name":"We ran into a real issue.\n\nA GCP PoC (GKE + Cloud SQL) kept running and the bill crossed $1200.\n\nProblem: Budget alerts only notify — they don’t stop anything.\n\nSo we built a Terraform-based billing kill switch.\n\nCurious — how do you control"}]}
```

