fix(terraform): add soft_budget, tags, and soft_budget_alerting_emails to litellm_team - #37918
Merged
yuneng-berri merged 2 commits intoAug 24, 2026
Merged
Conversation
…s to litellm_team The team resource rejected soft_budget and tags at plan time and had no way to express the list-valued metadata.soft_budget_alerting_emails the proxy reads for soft-budget alerts, even though /team/new and /team/update accept all three. Add the attributes, forward them in buildTeamData (alert emails merged under metadata, where the proxy stores them), and send the full metadata map whenever either half changes because /team/update replaces metadata wholesale. Read was decoding /team/info as if the team fields were top-level, but the proxy nests them under team_info, so every attribute silently fell back to prior state. Decode the envelope and split the proxy's metadata back into tags / soft_budget_alerting_emails / string metadata, dropping the server-managed team_member_budget_id. Verified with OpenTofu plan/apply against a live proxy: the attributes are accepted, land on the proxy, refresh into state, re-plan clean, propagate on update, and clear when removed from HCL.
Contributor
Greptile SummaryThis PR adds Terraform support for team soft budgets, tags, and alert recipients while correcting team-info response decoding and state refresh behavior.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| terraform/provider/litellm/resource_team.go | Adds schema and payload/state mappings for the new team attributes and now clears soft_budget state when the proxy returns null. |
| terraform/provider/litellm/resource_team_test.go | Adds focused tests for team creation, response-envelope decoding, removed attributes, and null soft-budget refresh behavior. |
| terraform/provider/litellm/types.go | Adds the team-info response envelope and nullable soft-budget response field. |
| terraform/provider/docs/resources/team.md | Documents the newly supported Terraform team attributes. |
| terraform/provider/CHANGELOG.md | Records the added attributes and corrected team-info state refresh. |
Reviews (2): Last reviewed commit: "fix(terraform): clear litellm_team.soft_..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…y returns null Read only wrote soft_budget when the proxy returned a value, so a soft budget cleared outside Terraform stayed in state and never surfaced as drift. Set it from the response unconditionally so a null clears it.
Contributor
Author
yuneng-berri
enabled auto-merge (squash)
August 23, 2026 05:37
ryan-crabbe-berri
approved these changes
Aug 24, 2026
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:
litellm_teamin the Terraform provider has nosoft_budgetortagsattributesmetadatais string-only, sosoft_budget_alerting_emails(a list) can't be setplanwith "An argument named ... is not expected here"/team/newand/team/updatealready accept all threeHow it solves it:
soft_budget,tags,soft_budget_alerting_emailsto the team schemametadatawhere the proxy reads themteam_infoenvelope/team/infoactually returnstags/soft_budgetfrom HCL clears them on the proxyUser Flow
Before: a platform engineer managing teams with Terraform cannot set a soft budget, tags, or alert recipients on a team, and the proxy's soft-budget alerts for that team never fire
soft_budget = 600.0,tags = [...], andsoft_budget_alerting_emails = [...]to aresource "litellm_team"blockterraform planand getError: Unsupported argument — An argument named "soft_budget" is not expected here(same fortagsandsoft_budget_alerting_emails)POST https://litellm-domain/team/updateby hand with{"team_id": "...", "soft_budget": 600.0, "tags": [...]}, outside Terraformterraform plannothing is reported, because the provider never reads team attributes back fromGET https://litellm-domain/team/infoAfter: the same HCL applies, lands on the proxy, and stays in sync
soft_budget = 600.0,tags = [...], andsoft_budget_alerting_emails = [...]to the sameresource "litellm_team"blockterraform planaccepts the configuration and shows the three attributes in the planned create/updateterraform applysends them onPOST https://litellm-domain/team/new(or/team/update);GET https://litellm-domain/team/info?team_id=...returns"soft_budget": 600.0and"metadata": {"tags": [...], "soft_budget_alerting_emails": [...], ...}terraform planreportsNo changes; a value changed outside Terraform now shows up as drift on the next planRelevant issues
Pylon #7469
Linear ticket
Resolves LIT-5708
Pre-Submission checklist
cd terraform/provider && go test -timeout 120s ./...Screenshots / Proof of Fix
Provider built from the branch and loaded through
dev_overrides; OpenTofu 1.12.6 against a proxy onlocalhost:4080with an isolated Postgres. Shared HCL:Before (3ac339c)
Plan with soft_budget / tags / alert emails
tofu plan -no-color -input=falseApply, then read back from the proxy
tofu apply -auto-approve— fails with the same threeUnsupported argumenterrors; no team is createdRemove the attributes from HCL
soft_budget cleared outside Terraform
After (d96ce4e)
Plan with soft_budget / tags / alert emails
tofu plan -no-color -input=falsePlan: 1 to add, 0 to change, 0 to destroy.Apply, then read back from the proxy
tofu apply -auto-approvecurl -s "http://localhost:4080/team/info?team_id=a6a10857-..." -H "Authorization: Bearer sk-1234" | jq -c '.team_info | {soft_budget,max_budget,metadata}'{"soft_budget":600.0,"max_budget":750.0,"metadata":{"tags":["team:customer-insights","environment:production"],"department":"customer-insights","soft_budget_alerting_emails":["finops@example.com"]}}tofu show -json | jq -c '.values.root_module.resources[0].values | {soft_budget,tags,soft_budget_alerting_emails,metadata}'{"soft_budget":600,"tags":["team:customer-insights","environment:production"],"soft_budget_alerting_emails":["finops@example.com"],"metadata":{"department":"customer-insights"}}tofu plan -detailed-exitcode→No changes. Your infrastructure matches the configuration.(exit 0)soft_budget = 650.0,tags = ["team:customer-insights", "environment:staging"];tofu apply -auto-approve→Resources: 0 added, 1 changed, 0 destroyed.curlon/team/info:{"soft_budget":650.0,"metadata":{"tags":["team:customer-insights","environment:staging"],"department":"customer-insights","soft_budget_alerting_emails":["finops@example.com"]}}Remove the attributes from HCL
soft_budget,tags,soft_budget_alerting_emailsfrom the block;tofu apply -auto-approve→0 added, 1 changed, 0 destroyedcurlon/team/info:{"soft_budget":null,"metadata":{"tags":[],"department":"eng"}}tofu plan -detailed-exitcode→No changes. Your infrastructure matches the configuration.soft_budget cleared outside Terraform
max_budget = 750.0,soft_budget = 600.0curl -X POST http://localhost:4080/team/update -H "Authorization: Bearer sk-1234" -d '{"team_id":"...","soft_budget":null}';/team/infonow returns"soft_budget": nulltofu plan -detailed-exitcode→ exit 2,~ soft_budget = 0 -> 600,Plan: 0 to add, 1 to change, 0 to destroy.Also verified on both commits (pass before and after): the pre-existing attribute set applies, matches
/team/info, re-plans clean, updates, and destroys; a minimalteam_alias-only team re-plans clean;litellm_keystill round-tripssoft_budget+tags.Type
🐛 Bug Fix
Caveats (if any)
metadatastays string-only: Terraform SDK v2 has no list-valued map elements, hence the dedicated attributelitellm_teamhas noImportereven though the docs describeterraform import; pre-existing, not touched here