-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbudget.tf
32 lines (30 loc) · 1.35 KB
/
budget.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
resource "oci_budget_budget" "default" {
amount = var.budget
compartment_id = var.oci_tenancy_id
defined_tags = local.default_tags
display_name = "org-wide-budget"
reset_period = "MONTHLY"
targets = [var.oci_tenancy_id]
}
resource "oci_budget_alert_rule" "critical" {
budget_id = oci_budget_budget.default.id
display_name = "${var.budget_alert_threshold}-percent-of-budget-spent"
defined_tags = local.default_tags
description = "Alert when ${var.budget_alert_threshold}% of the budget is spent"
message = "CRITICAL: You have spent ${var.budget_alert_threshold}% of your £${var.budget} budget"
recipients = var.budget_alert_email
type = "ACTUAL"
threshold = var.budget_alert_threshold
threshold_type = "PERCENTAGE"
}
resource "oci_budget_alert_rule" "warning" {
budget_id = oci_budget_budget.default.id
display_name = "projected-to-spend-${var.budget_alert_threshold}-percent-of-budget"
defined_tags = local.default_tags
description = "Alert when projected to spend ${var.budget_alert_threshold}% of budget"
message = "WARN: You are projected to spend ${var.budget_alert_threshold}% of your £${var.budget} budget"
recipients = var.budget_alert_email
type = "FORECAST"
threshold = var.budget_alert_threshold
threshold_type = "PERCENTAGE"
}