forked from 2i2c-org/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
terraform, gcp: let budget alerts display a reference to related project
- Loading branch information
1 parent
6cfbb49
commit cc6b571
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
# Alerts sent to [email protected] for things that *will go bad* in the future | ||
# if left unattended. Should *not* be used for immediate outages | ||
# Alerts sent to support+budget-${var.prefix}@2i2c.org for things that *will go | ||
# bad* in the future if left unattended. Should *not* be used for immediate | ||
# outages | ||
|
||
resource "google_monitoring_notification_channel" "support_email" { | ||
count = var.budget_alert_enabled ? 1 : 0 | ||
project = var.project_id | ||
display_name = "[email protected] email" | ||
display_name = "Email support+budget-${var.prefix}@2i2c.org" | ||
type = "email" | ||
labels = { | ||
email_address = "[email protected]" | ||
email_address = "support+budget-${var.prefix}@2i2c.org" | ||
} | ||
} | ||
|
||
|
@@ -16,11 +17,12 @@ data "google_project" "project" { | |
} | ||
|
||
# Need to explicitly enable https://console.cloud.google.com/apis/library/billingbudgets.googleapis.com?project=two-eye-two-see | ||
# resource ref: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/billing_budget | ||
resource "google_billing_budget" "budget" { | ||
count = var.budget_alert_enabled ? 1 : 0 | ||
|
||
billing_account = var.billing_account_id | ||
display_name = "Billing alert" | ||
display_name = "Auto-adjusting budget for ${var.prefix}" | ||
|
||
budget_filter { | ||
# Use project number here, as project_name seems to be converted internally to number | ||
|