From ff8b48ba9dea786d2f5a4db44685aa2605fcf101 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 8 Jun 2023 12:09:47 -0700 Subject: [PATCH] added DSF for plan in google_bigquery_capacity_commitment (#7999) (#5748) Signed-off-by: Modular Magician --- .changelog/7999.txt | 3 +++ .../resource_bigquery_capacity_commitment.go | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .changelog/7999.txt diff --git a/.changelog/7999.txt b/.changelog/7999.txt new file mode 100644 index 0000000000..8ec013c069 --- /dev/null +++ b/.changelog/7999.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` diff --git a/google-beta/services/bigqueryreservation/resource_bigquery_capacity_commitment.go b/google-beta/services/bigqueryreservation/resource_bigquery_capacity_commitment.go index 89956b6db9..7635d8efc2 100644 --- a/google-beta/services/bigqueryreservation/resource_bigquery_capacity_commitment.go +++ b/google-beta/services/bigqueryreservation/resource_bigquery_capacity_commitment.go @@ -30,6 +30,13 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) +func bigqueryReservationCapacityCommitmentPlanDiffSuppressFunc(_, old, new string, _ *schema.ResourceData) bool { + if (old == "FLEX" || old == "MONTHLY" || old == "ANNUAL") && new == old+"_FLAT_RATE" { + return true + } + return false +} + func ResourceBigqueryReservationCapacityCommitment() *schema.Resource { return &schema.Resource{ Create: resourceBigqueryReservationCapacityCommitmentCreate, @@ -49,9 +56,10 @@ func ResourceBigqueryReservationCapacityCommitment() *schema.Resource { Schema: map[string]*schema.Schema{ "plan": { - Type: schema.TypeString, - Required: true, - Description: `Capacity commitment plan. Valid values are at https://cloud.google.com/bigquery/docs/reference/reservations/rpc/google.cloud.bigquery.reservation.v1#commitmentplan`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: bigqueryReservationCapacityCommitmentPlanDiffSuppressFunc, + Description: `Capacity commitment plan. Valid values are at https://cloud.google.com/bigquery/docs/reference/reservations/rpc/google.cloud.bigquery.reservation.v1#commitmentplan`, }, "slot_count": { Type: schema.TypeInt,