add support for custom periods in factory budgets (#3674)

This commit is contained in:
Ludovico Magnocavallo
2026-01-24 10:58:25 +01:00
committed by GitHub
parent 447420f173
commit 91973aca23
4 changed files with 75 additions and 7 deletions

View File

@@ -247,7 +247,7 @@ module "billing-account" {
budgets_data_path = "data/billing-budgets"
}
}
# tftest modules=1 resources=2 files=test-1 inventory=budget-monitoring-channel.yaml
# tftest modules=1 resources=2 files=test-1 inventory=budget-factory.yaml
```
```yaml
@@ -256,7 +256,11 @@ amount:
units: 100
filter:
period:
calendar: MONTH
custom:
start_date:
day: 1
month: 1
year: 2026
resource_ancestors:
- folders/1234567890
threshold_rules:

View File

@@ -54,10 +54,6 @@ resource "google_monitoring_notification_channel" "default" {
# condition = local.factory_budgets == null
# error_message = yamlencode(local.factory_budgets)
# }
# precondition {
# condition = local.factory_budgets == null
# error_message = yamlencode(local.ctx.project_sets)
# }
# }
# }

View File

@@ -44,7 +44,11 @@ locals {
v.filter.credit_types_treatment
)
)
label = try(v.filter.label, null)
label = try(v.filter.label, null)
period = try(v.filter.period, null) == null ? null : merge(
{ calendar = null, end_date = null, start_date = null },
v.filter.period
)
projects = try(v.filter.projects, [])
resource_ancestors = try(v.filter.resource_ancestors, [])
services = try(v.filter.services, null)