ce7cb702218693d08ea6d83464d2457c9250027c

This commit is contained in:
ms2k 2026-11-12 20:46:28 +09:00
commit 34c5f8963c

45
terraform/external/oci-relay/budget.tf vendored Normal file
View file

@ -0,0 +1,45 @@
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
}