Skip to content

Commit

Permalink
Merge pull request #2 from artefactory/cn/fix/dynamic_update_rules_go…
Browse files Browse the repository at this point in the history
…ogle_billing_budget

cn/fix/dynamic_update_rules_google_billing_budget
  • Loading branch information
AlexisVLRT authored Sep 25, 2023
2 parents ac20b4e + 6c0659c commit 01e9e8f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions budget.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ resource "google_billing_budget" "relative_amount_budget" {
}
}

all_updates_rule {
monitoring_notification_channels = var.budgets.relative_amount.alerts.notification_channels
pubsub_topic = var.budgets.relative_amount.alerts.pubsub_topic
disable_default_iam_recipients = var.budgets.relative_amount.alerts.disable_default_iam_recipients
dynamic "all_updates_rule" {
for_each = length(var.budgets.relative_amount.alerts.notification_channels) > 0 ? [1] : []
content {
monitoring_notification_channels = var.budgets.relative_amount.alerts.notification_channels
pubsub_topic = var.budgets.relative_amount.alerts.pubsub_topic
disable_default_iam_recipients = var.budgets.relative_amount.alerts.disable_default_iam_recipients
}
}

depends_on = [google_project_service.billingbudgets]
Expand Down Expand Up @@ -65,10 +68,13 @@ resource "google_billing_budget" "absolute_amount_budget" {
}
}

all_updates_rule {
monitoring_notification_channels = var.budgets.absolute_amount.alerts.notification_channels
pubsub_topic = var.budgets.absolute_amount.alerts.pubsub_topic
disable_default_iam_recipients = var.budgets.absolute_amount.alerts.disable_default_iam_recipients
dynamic "all_updates_rule" {
for_each = length(var.budgets.relative_amount.alerts.notification_channels) > 0 ? [1] : []
content {
monitoring_notification_channels = var.budgets.relative_amount.alerts.notification_channels
pubsub_topic = var.budgets.relative_amount.alerts.pubsub_topic
disable_default_iam_recipients = var.budgets.relative_amount.alerts.disable_default_iam_recipients
}
}

depends_on = [google_project_service.billingbudgets]
Expand Down

0 comments on commit 01e9e8f

Please sign in to comment.