Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mmv1/products/bigqueryreservation/Reservation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ resource "google_bigquery_reservation" "{{$.PrimaryResourceId}}" {
autoscale {
max_slots = 100
}
labels = {
"environment" = "production"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down