Repository navigation
fix(terraform): keep prior state when the proxy rejects a virtual key update - #40540
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
… update 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 SummaryThe PR enables Terraform partial-state handling when a virtual-key update fails, preventing rejected planned values from replacing the prior state
Confidence Score: 5/5The PR appears safe to merge and correctly preserves prior state after failed virtual-key updates The partial-state call is made before returning the update diagnostic, while the successful update path remains unchanged
|
| Filename | Overview |
|---|---|
| terraform/provider/litellm/resource_key.go | Preserves prior Terraform state when the proxy rejects or fails a virtual-key update |
Reviews (1): Last reviewed commit: "fix(terraform): keep prior state when th..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
/key/updatestill wrote planned values into Terraform stateterraform planshowed "No changes" and silently dropped the editTestResourceKeyUpdateFailureKeepsPriorStatefails onlitellm_internal_staging(broken by fix(terraform): keep prior state when a virtual key update is rejected #40512)How it solves it:
d.Partial(true)on thec.UpdateKeyerror branch ofresourceKeyUpdate, as fix(terraform): keep prior state when a virtual key update is rejected #40512 intendedUser Flow
Before: an operator editing a
litellm_keygets a rejected update that still looks applied on the next planbudget_duration = "bad"on theirlitellm_keyand runterraform applyInvalid budget_duration 'bad', apply prints the errorbudget_duration = "bad"anywayterraform planreports "No changes", so the broken value is never revisitedAfter: the same rejection leaves state untouched so the diff keeps showing up
budget_duration = "bad"on theirlitellm_keyand runterraform applyInvalid budget_duration 'bad', apply prints the errorbudget_durationterraform planstill shows the pending change, so the operator can 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 more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
The regression test drives the real provider update path against an HTTP server that answers
/key/updatewith the proxy's 400, then inspects the resulting stateBefore (69245fe)
cd terraform/provider && go test ./litellm/ -run TestResourceKeyUpdateFailureKeepsPriorState -vAfter (2cf6f47)
cd terraform/provider && gofmt -l . && go vet ./... && go test ./...Type
🐛 Bug Fix
Caveats (if any)
Low
Link to Devin session: https://app.devin.ai/sessions/ec91c5ef3b2c4b7793fc1b346b989b12
Open in Devin Desktop: https://app.devin.ai/desktop/session/ec91c5ef3b2c4b7793fc1b346b989b12?variant=devin
Requested by: @yassin-berriai