BigQuery reservation (#3441)

* First Commit.

* Improve

* Fix README

* Fix lint

* fix

* Fix Tests.

* Improve output

* fix yaml lint

* Fix

* Fic test

* Fix

* Fix output
This commit is contained in:
lcaggio
2025-11-03 11:36:42 +01:00
committed by GitHub
parent 0a70b9dd2c
commit 64632eb957
6 changed files with 361 additions and 46 deletions

View File

@@ -20,6 +20,43 @@ variable "auto_create_network" {
default = false
}
variable "bigquery_reservations" {
description = "BigQuery reservations and assignments. Assignment specified as {JOB_TYPE = ['projects/PROJECT_ID']}."
type = map(object({
location = string
slot_capacity = number
ignore_idle_slots = optional(bool, false)
concurrency = optional(number)
edition = optional(string, "STANDARD")
secondary_location = optional(string)
max_slots = optional(number)
scaling_mode = optional(string, "AUTOSCALE_ONLY")
assignments = optional(map(list(string)), {})
}))
validation {
condition = alltrue([
for name, reservation in var.bigquery_reservations :
# Check the keys of the 'assignments' map within each reservation object.
# If 'assignments' is omitted (defaults to {}), the inner 'alltrue' evaluates to true.
alltrue([
for key in keys(reservation.assignments) :
contains(["JOB_TYPE_UNSPECIFIED",
"PIPELINE",
"QUERY",
"ML_EXTERNAL",
"BACKGROUND",
"CONTINUOUS",
"BACKGROUND_CHANGE_DATA_CAPTURE",
"BACKGROUND_COLUMN_METADATA_INDEX",
"BACKGROUND_SEARCH_INDEX_REFRESH"], key)
])
])
error_message = "All keys in the nested 'assignments' map (within 'bigquery_reservations') must be one of the following allowed values: ML_EXTERNAL, QUERY, or BACKGROUND."
}
default = {}
nullable = false
}
variable "billing_account" {
description = "Billing account id."
type = string