Repository navigation
fix(terraform): restore d.Partial(true) on a rejected /key/update - #40527
Conversation
The squash of #40512 onto a base that already carried #40514 left the Partial call on the metadata pre-read error path only, so a rejected /key/update again persisted the planned values into state and TestResourceKeyUpdateFailureKeepsPriorState fails on the default branch. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryRestores Terraform partial-state handling when the LiteLLM key update API rejects an update.
Confidence Score: 5/5The PR appears safe to merge and correctly restores prior-state preservation for rejected key updates. The change is narrowly placed on the API error path, and the relevant regression test confirms that failed updates retain the previous state without persisting rejected planned values.
|
| Filename | Overview |
|---|---|
| terraform/provider/litellm/resource_key.go | Adds d.Partial(true) to the rejected key-update path so Terraform preserves the prior resource state. |
Reviews (1): Last reviewed commit: "fix(terraform): restore d.Partial(true) ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
2bf065f
into
litellm_internal_staging
TLDR
Problem this solves:
d.Partial(true)from fix(terraform): keep prior state when a virtual key update is rejected #40512 ended up on the wrong error path after the two PRs were combined/key/updateonce again writes the planned values into Terraform stateHow it solves it:
d.Partial(true)before returning the/key/updateerror, the same one-line fix fix(terraform): keep prior state when a virtual key update is rejected #40512 shippedUser Flow
Before: an operator whose
litellm_keyupdate is rejected by the proxy sees the rejected values land in state anywaybudget_duration = "bad"on alitellm_keyand runterraform applyInvalid budget_duration 'bad'and apply failsterraform planreports no changes because the state already holdsbudget_duration = "bad"After: the same rejected apply leaves the prior state alone
budget_duration = "bad"on alitellm_keyand runterraform applyInvalid budget_duration 'bad'and apply failsterraform planstill shows the pendingbudget_durationchange, so the mistake stays visibleRelevant issues
Follow-up to #40512 and #40514
Linear ticket
Resolves LIT-6398
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
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 more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
The regression test from #40512,
TestResourceKeyUpdateFailureKeepsPriorState, drives the real providerApplyagainst an httptest proxy that answers 400 on/key/update. It is the check that is currently red onlitellm_internal_staging. The live Terraform CLI run against a real proxy for this behavior is in #40512 and was not repeated for this one-line repairBefore (87e2026)
cd terraform/provider && go test -timeout 120s -run TestResourceKeyUpdateFailureKeepsPriorState ./litellm/After (ecbea89)
cd terraform/provider && go test -timeout 120s -run TestResourceKeyUpdateFailureKeepsPriorState ./litellm/gofmt -l .prints nothing,go vet ./...andgo build ./...pass,go test -timeout 120s ./...is green for both packagesType
🐛 Bug Fix
Caveats (if any)
Low
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/9dee2130c54c4433a7dd04ee48fb777c
Open in Devin Desktop: https://app.devin.ai/desktop/session/9dee2130c54c4433a7dd04ee48fb777c?variant=devin
Requested by: @yassin-berriai