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 <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-09-10 04:04:32 +00:00
parent 87e2026f0a
commit 925601810a
No known key found for this signature in database

View file

@ -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))
}