diff --git a/mmv1/products/bigqueryreservation/Reservation.yaml b/mmv1/products/bigqueryreservation/Reservation.yaml index cb0b6e854328..49f57b5db922 100644 --- a/mmv1/products/bigqueryreservation/Reservation.yaml +++ b/mmv1/products/bigqueryreservation/Reservation.yaml @@ -259,3 +259,8 @@ properties: resource: ReservationGroup imports: name diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName + - name: labels + type: KeyValueLabels + description: | + The labels associated with this reservation. You can use these to + organize and group your reservations. diff --git a/mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_basic.tf.tmpl b/mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_basic.tf.tmpl index 3d725e6069ea..529dec889332 100644 --- a/mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_basic.tf.tmpl +++ b/mmv1/templates/terraform/samples/services/bigqueryreservation/bigquery_reservation_basic.tf.tmpl @@ -10,4 +10,7 @@ resource "google_bigquery_reservation" "{{$.PrimaryResourceId}}" { autoscale { max_slots = 100 } + labels = { + "environment" = "production" + } } diff --git a/mmv1/third_party/terraform/services/bigqueryreservation/resource_bigquery_reservation_test.go.tmpl b/mmv1/third_party/terraform/services/bigqueryreservation/resource_bigquery_reservation_test.go.tmpl index 91d55360245c..095324a64d80 100644 --- a/mmv1/third_party/terraform/services/bigqueryreservation/resource_bigquery_reservation_test.go.tmpl +++ b/mmv1/third_party/terraform/services/bigqueryreservation/resource_bigquery_reservation_test.go.tmpl @@ -74,6 +74,80 @@ func TestAccBigqueryReservation_withScalingMode_update(t *testing.T) { {{ end }} +func TestAccBigqueryReservation_labels_update(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccBigqueryReservation_labels_basic(context), + }, + { + ResourceName: "google_bigquery_reservation.reservation", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, + }, + { + Config: testAccBigqueryReservation_labels_update(context), + }, + { + ResourceName: "google_bigquery_reservation.reservation", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, + }, + }, + }) +} + +func testAccBigqueryReservation_labels_basic(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_bigquery_reservation" "reservation" { + name = "tf-test-reservation-%{random_suffix}" + location = "us-west2" + slot_capacity = 0 + edition = "ENTERPRISE" + ignore_idle_slots = true + + autoscale { + max_slots = 100 + } + + labels = { + "environment" = "test" + "team" = "analytics" + } +} +`, context) +} + +func testAccBigqueryReservation_labels_update(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_bigquery_reservation" "reservation" { + name = "tf-test-reservation-%{random_suffix}" + location = "us-west2" + slot_capacity = 0 + edition = "ENTERPRISE" + ignore_idle_slots = true + + autoscale { + max_slots = 100 + } + + labels = { + "environment" = "production" + } +} +`, context) +} + func TestAccBigqueryReservation_reservationGroup_update(t *testing.T) { t.Parallel()