45 lines
1.2 KiB
HCL
45 lines
1.2 KiB
HCL
locals {
|
|
budget_alerts = {
|
|
actual-50 = {
|
|
threshold = 50
|
|
type = "ACTUAL"
|
|
}
|
|
actual-80 = {
|
|
threshold = 80
|
|
type = "ACTUAL"
|
|
}
|
|
actual-100 = {
|
|
threshold = 100
|
|
type = "ACTUAL"
|
|
}
|
|
forecast-100 = {
|
|
threshold = 100
|
|
type = "FORECAST"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "oci_budget_budget" "relay" {
|
|
amount = var.budget_amount
|
|
compartment_id = local.tenancy_ocid
|
|
description = "Monthly budget for the OCI L4 relay compartment"
|
|
display_name = "oci-l4-relay"
|
|
reset_period = "MONTHLY"
|
|
target_type = "COMPARTMENT"
|
|
targets = [local.compartment_id]
|
|
freeform_tags = var.freeform_tags
|
|
}
|
|
|
|
resource "oci_budget_alert_rule" "relay" {
|
|
for_each = local.budget_alerts
|
|
|
|
budget_id = oci_budget_budget.relay.id
|
|
description = "${each.value.type} relay spend reaches ${each.value.threshold}% of budget"
|
|
display_name = each.key
|
|
message = "Review OCI L4 relay spend before increasing or retaining paid capacity."
|
|
recipients = local.budget_alert_recipients
|
|
threshold = each.value.threshold
|
|
threshold_type = "PERCENTAGE"
|
|
type = each.value.type
|
|
freeform_tags = var.freeform_tags
|
|
}
|