From 925601810a9bd832701ff6c6303d9a221efcc077 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 10 Sep 2026 04:04:32 +0000 Subject: [PATCH] fix(terraform): call Partial(true) on rejected /key/update so state keeps prior values PR #40512 added d.Partial(true) only to the plannedKeyMetadata error branch of resourceKeyUpdate, but not to the c.UpdateKey error branch. When the proxy rejects an update (e.g. budget_duration='bad' returns 400), the SDK still persisted the planned values into state, dropping the update silently on the next plan. This adds d.Partial(true) to that branch, matching what TestResourceKeyUpdateFailureKeepsPriorState expects. Co-authored-by: Krrish Dholakia --- terraform/provider/litellm/resource_key.go | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/provider/litellm/resource_key.go b/terraform/provider/litellm/resource_key.go index ffdc448f5fe..018d01f75a8 100644 --- a/terraform/provider/litellm/resource_key.go +++ b/terraform/provider/litellm/resource_key.go @@ -327,6 +327,7 @@ func resourceKeyUpdate(ctx context.Context, d *schema.ResourceData, m interface{ key.Metadata = metadata if _, err := c.UpdateKey(key); err != nil { + d.Partial(true) return diag.FromErr(fmt.Errorf("error updating key: %s", err)) }