From b80f46fcb8872fdbd75eef72fc3f1ce5f874a458 Mon Sep 17 00:00:00 2001 From: Louis Vauterin Date: Tue, 22 Sep 2026 13:32:08 +0200 Subject: [PATCH] fix: address Greptile review on PR 42461 - CHANGELOG: narrowed the fix's scope to unified_access_group only. litellm_access_group (legacy) calls /access_group/new, a completely different, unrelated endpoint (model_access_group_management_endpoints.py) that already returns 200 -- it was never affected. I'd wrongly assumed both resources shared the same /v1/access_group route; they don't. - resource_team_test.go: removed the preamble comment above the new test, which restated what the table test already shows -- against repository guidance (AGENTS.md) that reserves comments for complex logic, tool inputs, or TODOs. Co-Authored-By: Claude Sonnet 5 --- terraform/provider/CHANGELOG.md | 2 +- terraform/provider/litellm/resource_team_test.go | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/terraform/provider/CHANGELOG.md b/terraform/provider/CHANGELOG.md index 165e4ea7861..04b1e5e10bb 100644 --- a/terraform/provider/CHANGELOG.md +++ b/terraform/provider/CHANGELOG.md @@ -57,7 +57,7 @@ longer signal it. - **key**: Updates no longer send an empty `budget_duration`, which the proxy rejects with a 400; any update to a key without a configured `budget_duration` previously failed outright - **key**: A config-supplied `key` value (write-only) is now forwarded to `/key/generate`; previously it was silently dropped and the proxy generated a random key instead - **security**: The `litellm_key` data source and `litellm_key_block` resource normalize raw `sk-` keys to their SHA-256 token hash before building request URLs and resource IDs, so plaintext keys no longer land in reverse-proxy access logs, Terraform plan output, or state IDs -- **access_group, unified_access_group**: create now accepts any 2xx response instead of requiring exactly HTTP 200; `POST /v1/access_group` (and its `/v1/unified_access_group` alias) legitimately returns 201, so `litellm_access_group` and `litellm_unified_access_group` create previously succeeded on the proxy but failed in the provider, leaving the group out of state and forcing a `terraform import` to recover on the next apply's 409. Same fix and shape as the one already applied to `mcp_server`/`model`/`key`/`organization_member`; `handleResponse` (shared by several other resources) was the one status-check helper that fix didn't reach +- **unified_access_group**: create now accepts any 2xx response instead of requiring exactly HTTP 200; `POST /v1/unified_access_group` legitimately returns 201, so creation previously succeeded on the proxy but failed in the provider, leaving the group out of state and forcing a `terraform import` to recover on the next apply's 409. Same fix and shape as the one already applied to `mcp_server`/`model`/`key`/`organization_member`; `handleResponse` (shared by several other resources) was the one status-check helper that fix didn't reach. The legacy `litellm_access_group` resource calls the unrelated `/access_group/new` endpoint, which already returns 200, so it was never affected ### Changed diff --git a/terraform/provider/litellm/resource_team_test.go b/terraform/provider/litellm/resource_team_test.go index 36008dd13f3..2aa8043ad89 100644 --- a/terraform/provider/litellm/resource_team_test.go +++ b/terraform/provider/litellm/resource_team_test.go @@ -435,13 +435,6 @@ func TestTeamLimitTypesSentOnCreateOnly(t *testing.T) { } } -// handleResponse is shared by several resources (team, access_group, -// unified_access_group, agent, budget, guardrail, organization, prompt, -// search_tool, tag, team_block, key_block, team_member(_add), user), but only -// access_group/unified_access_group's create actually hits a non-200 success -// status in practice: POST /v1/access_group (and its /v1/unified_access_group -// alias) answers 201, same shape as the mcp_server/model/key/organization_member -// bug already fixed for handleAPIResponse/handleMCPAPIResponse/sendRequest. func TestHandleResponseAcceptsFullSuccessRange(t *testing.T) { tests := []struct { name string