okustera_billing_budget (Resource)
The okustera_billing_budget resource sets monthly financial limits for a tenant project, configuring notification thresholds and optional automated quota freezing when spend approaches defined percentage milestones.
Tenant Role & Security Boundary
Tenants have full autonomy to declare budget caps and configure notification thresholds through this resource (PUT /api/v1/billing/budget). However, direct financial mutations (e.g. creating/deleting credit card payment methods or initiating checkout sessions) are strictly read-only for tenant callers and restricted to platform administrators to prevent accidental or unapproved billing modifications.
Example Usage
Tenant Budget Alerts with Automated Quota Freeze
resource "okustera_billing_budget" "dev_cap" {
monthly_budget_limit = 300.00
alert_thresholds = [50, 80, 90, 100]
enable_email_alerts = true
enable_quota_freeze = true
}
output "budget_id" {
value = okustera_billing_budget.dev_cap.id
}
output "current_consumed_percentage" {
value = "${okustera_billing_budget.dev_cap.percentage_consumed}%"
}
Schema
Required
monthly_budget_limit(Number) Monthly spending ceiling in USD (e.g.300.00).alert_thresholds(List of Number) Percentage milestones that trigger notification alerts (e.g.[50, 80, 90, 100]).
Optional
tenant_id(String) Tenant project identifier this budget rule applies to. Defaults to the provider's active tenant context.notification_email(String) Primary email address notified when spending thresholds are crossed.enable_email_alerts(Boolean) Dispatches alert warnings tonotification_emailupon threshold violations. Defaults totrue.enable_quota_freeze(Boolean) Automatically halts creation of new compute instances and volume expansions when 100% of the budget is reached. Defaults tofalse.
Read-Only Attributes
id(String) Unique budget policy identifier.current_spend(Number) Real-time accumulated spend in USD for the current billing cycle.percentage_consumed(Number) Real-time percentage of the active monthly budget currently utilized.
Import
Existing budget policies can be imported using the policy identifier:
terraform import okustera_billing_budget.dev_cap <budget_id>