27 lines
985 B
HCL
27 lines
985 B
HCL
resource "oci_budget_budget" "short" {
|
|
provider = oci.home
|
|
amount = 1
|
|
compartment_id = local.tenancy
|
|
description = "Tier S is expected to incur no monthly charges"
|
|
display_name = "short"
|
|
reset_period = "MONTHLY"
|
|
target_type = "COMPARTMENT"
|
|
targets = [oci_identity_compartment.ingress.id]
|
|
}
|
|
|
|
resource "oci_budget_alert_rule" "short" {
|
|
provider = oci.home
|
|
for_each = {
|
|
actual = { type = "ACTUAL", threshold = 1 }
|
|
forecast = { type = "FORECAST", threshold = 100 }
|
|
}
|
|
|
|
budget_id = oci_budget_budget.short.id
|
|
display_name = each.key
|
|
description = "${each.value.type} Tier S spend reaches ${each.value.threshold}% of budget"
|
|
message = "Tier S is expected to cost zero. Review charges in the short compartment."
|
|
recipients = data.vault_generic_secret.config.data["budget_alert_recipients"]
|
|
threshold = each.value.threshold
|
|
threshold_type = "PERCENTAGE"
|
|
type = each.value.type
|
|
}
|