Skip to content

Commit

Permalink
enabled historical adjustment for the budget
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Devyatkin <[email protected]>
  • Loading branch information
Andrey9kin committed Nov 20, 2024
1 parent b6bcb52 commit 3fb1fef
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/budget_alerts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ resource "aws_budgets_budget" "this" {
time_period_start = var.time_period_start
time_unit = var.time_unit

dynamic "auto_adjust_data" {
for_each = var.auto_adjust ? toset(["auto_adjust"]) : toset([])
content {
auto_adjust_type = "HISTORICAL"

historical_options {
budget_adjustment_period = var.budget_adjustment_period
}
}
}

dynamic "notification" {
for_each = merge(local.actual_notifications, local.forecasted_notifications)
content {
Expand Down
12 changes: 12 additions & 0 deletions modules/budget_alerts/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@ variable "notification_on_threshold_percentage" {
default = [100, 150, 200]
description = "(Optional) The percentage of the budget threshold to notify. With default values, notifications will be sent at 100%, 150%, and 200% of the budget `limit_amount`."
}

variable "auto_adjust" {
type = bool
default = true
description = "Auto adjust budget based on historical values"
}

variable "budget_adjustment_period" {
type = number
default = 6
description = "Number of month to look back for historical values"
}

0 comments on commit 3fb1fef

Please sign in to comment.