From 07807ece952055754a91a23665b15b81eac9af05 Mon Sep 17 00:00:00 2001 From: fuzmish <71511927+fuzmish@users.noreply.github.com> Date: Tue, 7 Jul 2026 03:23:22 +0900 Subject: [PATCH] bigqueryreservation: add principal field to ReservationAssignment --- .../ReservationAssignment.yaml | 18 ++++++++++++++++++ ...tion_assignment_full_with_principal.tf.tmpl | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_assignment_full_with_principal.tf.tmpl diff --git a/mmv1/products/bigqueryreservation/ReservationAssignment.yaml b/mmv1/products/bigqueryreservation/ReservationAssignment.yaml index 7d654849d90e..1cd2fd9a205c 100644 --- a/mmv1/products/bigqueryreservation/ReservationAssignment.yaml +++ b/mmv1/products/bigqueryreservation/ReservationAssignment.yaml @@ -60,6 +60,16 @@ samples: reservation_name: 'example-reservation' test_env_vars: project: 'PROJECT_NAME' + - name: 'bigquery_reservation_assignment_full_with_principal' + primary_resource_id: 'assignment' + exclude_basic_doc: true + steps: + - name: 'bigquery_reservation_assignment_full_with_principal' + resource_id_vars: + reservation_name: 'example-reservation' + test_env_vars: + project: 'PROJECT_NAME' + service_account: 'SERVICE_ACCT' parameters: - name: 'location' type: String @@ -91,6 +101,14 @@ properties: description: | Types of job, which could be specified when using the reservation. Possible values: JOB_TYPE_UNSPECIFIED, PIPELINE, QUERY, CONTINUOUS required: true + - name: 'principal' + type: String + description: | + Optional. Represents the principal for this assignment. If not empty, jobs run by this principal will utilize the associated reservation. Otherwise, jobs will fall back to using the reservation assigned to the project, folder, or organization (in that order). If no reservation is assigned at any of these levels, on-demand capacity will be used. The supported formats are: + * `principal://goog/subject/USER_EMAIL_ADDRESS` for users, + * `principal://iam.googleapis.com/projects/-/serviceAccounts/SA_EMAIL_ADDRESS` for service accounts, + * `principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT_ID` for workload identity pool identities. + * The special value `unknown_or_deleted_user` represents principals which cannot be read from the user info service, for example deleted users. - name: 'state' type: String description: | diff --git a/mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_assignment_full_with_principal.tf.tmpl b/mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_assignment_full_with_principal.tf.tmpl new file mode 100644 index 000000000000..5bbbfe0599d7 --- /dev/null +++ b/mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_assignment_full_with_principal.tf.tmpl @@ -0,0 +1,15 @@ +resource "google_bigquery_reservation" "basic" { + name = "{{index $.ResourceIdVars "reservation_name"}}" + project = "{{index $.TestEnvVars "project"}}" + location = "us-central1" + slot_capacity = 0 + ignore_idle_slots = false +} + +resource "google_bigquery_reservation_assignment" "{{$.PrimaryResourceId}}" { + assignee = "projects/{{index $.TestEnvVars "project"}}" + job_type = "QUERY" + location = "us-central1" + principal = "principal://iam.googleapis.com/projects/-/serviceAccounts/{{index $.TestEnvVars "service_account"}}" + reservation = google_bigquery_reservation.basic.id +}