From 49d8d3eb98d4a7e219d492dda917440cd9c93ef3 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 23 Feb 2026 12:29:02 -0800 Subject: [PATCH] [BigQuery] Add 'reservation_group' field to google_bigquery_reservation --- .../bigqueryreservation/Reservation.yaml | 130 ++++++++++-------- ...reservation_with_reservation_group.tf.tmpl | 14 ++ 2 files changed, 83 insertions(+), 61 deletions(-) create mode 100644 mmv1/templates/terraform/examples/bigquery_reservation_with_reservation_group.tf.tmpl diff --git a/mmv1/products/bigqueryreservation/Reservation.yaml b/mmv1/products/bigqueryreservation/Reservation.yaml index fa6a7158d557..084becfd48dd 100644 --- a/mmv1/products/bigqueryreservation/Reservation.yaml +++ b/mmv1/products/bigqueryreservation/Reservation.yaml @@ -12,110 +12,115 @@ # limitations under the License. --- -name: 'Reservation' +name: Reservation description: | A reservation is a mechanism used to guarantee BigQuery slots to users. references: guides: - 'Introduction to Reservations': 'https://cloud.google.com/bigquery/docs/reservations-intro' - api: 'https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1/projects.locations.reservations/create' -docs: -base_url: 'projects/{{project}}/locations/{{location}}/reservations' -create_url: 'projects/{{project}}/locations/{{location}}/reservations?reservationId={{name}}' -update_verb: 'PATCH' + Introduction to Reservations: https://cloud.google.com/bigquery/docs/reservations-intro + api: https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1/projects.locations.reservations/create +base_url: projects/{{project}}/locations/{{location}}/reservations update_mask: true +create_url: projects/{{project}}/locations/{{location}}/reservations?reservationId={{name}} +update_verb: PATCH +id_format: projects/{{project}}/locations/{{location}}/reservations/{{name}} +examples: + - name: bigquery_reservation_basic + primary_resource_id: reservation + vars: + name: my-reservation + - name: bigquery_reservation_with_disaster_recovery + primary_resource_id: reservation + exclude_docs: true + vars: + name: my-reservation + - name: bigquery_reservation_with_reservation_group + primary_resource_id: reservation + vars: + group_name: my-group + name: my-reservation +exclude_sweeper: true timeouts: insert_minutes: 20 update_minutes: 20 delete_minutes: 20 -custom_code: -exclude_sweeper: true -examples: - - name: 'bigquery_reservation_basic' - primary_resource_id: 'reservation' - vars: - name: 'my-reservation' - - name: 'bigquery_reservation_with_disaster_recovery' - primary_resource_id: 'reservation' - vars: - name: 'my-reservation' - exclude_docs: true +autogen_status: "" parameters: - - name: 'location' + - name: location type: String + default_value: US description: | The geographic location where the transfer config should reside. Examples: US, EU, asia-northeast1. The default value is US. - url_param_only: true immutable: true - default_value: "US" - - name: 'name' + url_param_only: true + - name: name type: String + required: true description: | The name of the reservation. This field must only contain alphanumeric characters or dash. - url_param_only: true - required: true immutable: true + url_param_only: true properties: - - name: 'slotCapacity' + - name: slotCapacity type: Integer + required: true description: | Minimum slots available to this reservation. A slot is a unit of computational power in BigQuery, and serves as the unit of parallelism. Queries using this reservation might use more slots during runtime if ignoreIdleSlots is set to false. - required: true - - name: 'ignoreIdleSlots' + - name: ignoreIdleSlots type: Boolean + default_value: false description: | If false, any query using this reservation will use idle slots from other reservations within the same admin project. If true, a query using this reservation will execute with the slot capacity specified above at most. - default_value: false - - name: 'concurrency' + - name: concurrency type: Integer + default_value: 0 description: | Maximum number of queries that are allowed to run concurrently in this reservation. This is a soft limit due to asynchronous nature of the system and various optimizations for small queries. Default value is 0 which means that concurrency will be automatically set based on the reservation size. - default_value: 0 - - name: 'edition' + - name: edition type: String description: | The edition type. Valid values are STANDARD, ENTERPRISE, ENTERPRISE_PLUS immutable: true default_from_api: true - - name: 'autoscale' + - name: autoscale type: NestedObject description: | The configuration parameters for the auto scaling feature. properties: - - name: 'currentSlots' + - name: currentSlots type: Integer description: | The slot capacity added to this reservation when autoscale happens. Will be between [0, max_slots]. output: true - - name: 'maxSlots' + - name: maxSlots type: Integer description: | Number of slots to be scaled when needed. - - name: 'primaryLocation' + - name: primaryLocation type: String description: | The current location of the reservation's primary replica. This field is only set for reservations using the managed disaster recovery feature. output: true - - name: 'secondaryLocation' + - name: secondaryLocation type: String description: | The current location of the reservation's secondary replica. This field is only set for reservations using the managed disaster recovery feature. Users can set this in create reservation calls to create a failover reservation or in update reservation calls to convert a non-failover reservation to a failover reservation(or vice versa). - - name: 'originalPrimaryLocation' + - name: originalPrimaryLocation type: String description: | The location where the reservation was originally created. This is set only during the failover reservation's creation. All billing charges for the failover reservation will be applied to this location. output: true - - name: 'replicationStatus' + - name: replicationStatus type: NestedObject description: | The Disaster Recovery(DR) replication status of the reservation. This is only available for @@ -124,41 +129,40 @@ properties: from the primary to the secondary. If this field is blank, it means that the reservation is either not a DR reservation or the reservation is a DR secondary or that any replication operations on the reservation have succeeded. + output: true properties: - - name: 'error' + - name: error type: NestedObject description: | The last error encountered while trying to replicate changes from the primary to the secondary. This field is only available if the replication has not succeeded since. + output: true properties: - - name: 'code' + - name: code type: Integer description: | The status code, which should be an enum value of [google.rpc.Code](https://cloud.google.com/bigquery/docs/reference/reservations/rpc/google.rpc#google.rpc.Code). output: true - - name: 'message' + - name: message type: String description: | A developer-facing error message, which should be in English. output: true - output: true - - name: 'lastErrorTime' + - name: lastErrorTime type: Time description: | The time at which the last error was encountered while trying to replicate changes from the primary to the secondary. This field is only available if the replication has not succeeded since. output: true - - name: 'lastReplicationTime' + - name: lastReplicationTime type: Time description: | A timestamp corresponding to the last change on the primary that was successfully replicated to the secondary. output: true - output: true - - name: 'scalingMode' + - name: scalingMode type: Enum - min_version: beta description: | The scaling mode for the reservation. If the field is present but maxSlots is not present, requests will be rejected with error code google.rpc.Code.INVALID_ARGUMENT. @@ -197,18 +201,18 @@ properties: available in other reservations, it will scale up to 1000 slots with 200 baseline and 800 autoscaling slots. Please note, in this mode, the ignoreIdleSlots field must be set to false. Otherwise the request will be rejected with error code google.rpc.Code.INVALID_ARGUMENT. - enum_values: - - 'SCALING_MODE_UNSPECIFIED' - - 'AUTOSCALE_ONLY' - - 'IDLE_SLOTS_ONLY' - - 'ALL_SLOTS' - required_with: - - 'maxSlots' + min_version: beta conflicts: - - 'autoscale' - - name: 'maxSlots' + - autoscale + required_with: + - maxSlots + enum_values: + - SCALING_MODE_UNSPECIFIED + - AUTOSCALE_ONLY + - IDLE_SLOTS_ONLY + - ALL_SLOTS + - name: maxSlots type: Integer - min_version: beta description: | The overall max slots for the reservation, covering slotCapacity (baseline), idle slots (if ignoreIdleSlots is false) and scaled slots. If present, the reservation won't use @@ -249,7 +253,11 @@ properties: Please note that if maxSlots is set to 0, we will treat it as unset. Customers can set maxSlots to 0 and set scalingMode to SCALING_MODE_UNSPECIFIED to disable the maxSlots feature. - required_with: - - 'scalingMode' + min_version: beta conflicts: - - 'autoscale' + - autoscale + required_with: + - scalingMode + - name: reservationGroup + type: String + description: 'Optional. The reservation group that this reservation belongs to. You can set this property when you create or update a reservation. Reservations do not need to belong to a reservation group. Format: projects/{project}/locations/{location}/reservationGroups/{reservation_group} or just {reservation_group}' diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_with_reservation_group.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_with_reservation_group.tf.tmpl new file mode 100644 index 000000000000..879fd99a6a0a --- /dev/null +++ b/mmv1/templates/terraform/examples/bigquery_reservation_with_reservation_group.tf.tmpl @@ -0,0 +1,14 @@ +resource "google_bigquery_reservation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" + location = "us-west2" + // Set to 0 for testing purposes + // In reality this would be larger than zero + slot_capacity = 0 + edition = "ENTERPRISE" + ignore_idle_slots = true + concurrency = 0 + autoscale { + max_slots = 100 + } + reservation_group = "{{index $.Vars "group_name"}}" +} \ No newline at end of file