generated from cds-snc/project-template
-
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.
Merge pull request #10 from cds-snc/feat/add_budget_alarms
Add budget alarms so that we are aware of costs
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 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 |
---|---|---|
|
@@ -60,3 +60,28 @@ resource "azurerm_cognitive_deployment" "deployment" { | |
capacity = 50 # Represents 50,000 TPM | ||
} | ||
} | ||
|
||
# Create a budget alarm with default of $25/month | ||
resource "azurerm_consumption_budget_resource_group" "openai_budget" { | ||
name = "openai-budget" | ||
resource_group_id = azurerm_resource_group.rg.id | ||
amount = var.budget_amount | ||
time_grain = var.budget_time_grain | ||
|
||
# Let the budget alarm expire in 10 years. We basically want to send the budget alarm to the user for indeterminate, which is currently max 10 years in the settings. | ||
time_period { | ||
start_date = "2025-02-01T00:00:00Z" | ||
end_date = "2035-02-01T00:00:00Z" | ||
} | ||
notification { | ||
enabled = true | ||
threshold = 80 | ||
operator = "EqualTo" | ||
threshold_type = "Forecasted" | ||
# Send notifications to the SRE team and requestor email(s) when we are at 80% of the forecasted budget | ||
contact_emails = concat( | ||
["[email protected]"], | ||
var.requestor_emails | ||
) | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ module "valentine_api_key" { | |
name = "valentine" | ||
custom_subdomain_name = "valentine" | ||
resource_group_name_prefix = "valentine" | ||
requestor_emails = ["[email protected]"] | ||
} | ||
|
||
module "ai_answers_api_key" { | ||
|
@@ -12,4 +13,6 @@ module "ai_answers_api_key" { | |
name = "ai-answers" | ||
custom_subdomain_name = "ai-answers" | ||
resource_group_name_prefix = "ai-answers" | ||
budget_amount = 50 | ||
requestor_emails = ["[email protected]"] | ||
} |