Skip to content

Commit

Permalink
Add budget to k8s-infra-ii-sandbox
Browse files Browse the repository at this point in the history
Add a defined budget to `k8s-infra-ii-sandbox` but also use the project
to experiment GCP budgets.

Ref: kubernetes#1375

Signed-off-by: Arnaud Meukam <[email protected]>
  • Loading branch information
ameukam committed Apr 26, 2021
1 parent d309e7b commit f760c69
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions infra/gcp/clusters/projects/k8s-infra-ii-sandbox/budget.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
This file contains
- defined budget for this project
- notification channel when threshold is reached
*/

resource "google_billing_budget" "budget" {
billing_account = data.google_billing_account.account.id
display_name = "Billing Budget for ${google_project.project.id}"

budget_filter {
projects = ["projects/${google_project.project.number}"]
}

amount {
specified_amount {
units = "1000"
}
}

threshold_rules {
threshold_percent = 0.9 // Threshold of 90% of the budget set
}

all_updates_rule {
monitoring_notification_channels = [
google_monitoring_notification_channel.wg_k8s_infra_leads.id,
]
disable_default_iam_recipients = true
}
}

resource "google_monitoring_notification_channel" "wg_k8s_infra_leads" {
display_name = "Example Notification Channel"
type = "email"

labels = {
email_address = "[email protected]"
}
}

0 comments on commit f760c69

Please sign in to comment.