Repository navigation
fix(terraform): keep prior state when the proxy rejects a virtual key update - #40538
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
…eeps 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>
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
4 of 5 tasks
devin-ai-integration
Bot
changed the base branch from
litellm_internal_staging
to
main
September 23, 2026 14:37
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
/key/updatestill overwrote state with the planned valuesterraform planthen reported no changes and dropped the update silentlyTestResourceKeyUpdateFailureKeepsPriorStatewas failing onlitellm_internal_stagingHow it solves it:
d.Partial(true)on thec.UpdateKeyerror branch, matching what fix(terraform): keep prior state when a virtual key update is rejected #40512 intendedUser Flow
Before: an operator managing a
litellm_keyin Terraform editsbudget_durationto a value the proxy rejects, and the next plan looks clean even though the change never landedbudget_duration = "bad"in their.tfand runterraform applyPOST /key/updatereturns 400 withInvalid budget_duration 'bad', apply prints an errorbudget_duration = "bad"into the state fileterraform planon the next run reports "No changes" and the intended edit is silently droppedAfter: the same rejection surfaces as an error and leaves the state alone, so the operator can fix the value and try again
budget_duration = "bad"in their.tfand runterraform applyPOST /key/updatereturns 400 withInvalid budget_duration 'bad', apply prints an errorbudget_duration = "bad"is not persistedterraform planon the next run still shows the diff, giving the operator a chance to correct itRelevant issues
Linear ticket
Pre-Submission checklist
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreScreenshots / Proof of Fix
Before (87e2026)
cd terraform/provider && go test ./litellm/ -run TestResourceKeyUpdateFailureKeepsPriorState -vAfter (9256018)
cd terraform/provider && go test ./litellm/ -run TestResourceKeyUpdateFailureKeepsPriorState -vgo test ./...→ok github.com/BerriAI/terraform-provider-litellm/litellm 5.081sType
🐛 Bug Fix
Caveats (if any)
Final Attestation