Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/resources/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ resource "litellm_team" "engineering" {

```hcl
resource "litellm_team" "advanced_team" {
team_id = "ai-research-team-id"
team_alias = "ai-research-team"
organization_id = "org_123456"
models = ["gpt-4-proxy", "claude-2", "gpt-3.5-turbo"]
Expand Down Expand Up @@ -85,6 +86,8 @@ resource "litellm_team" "model_dependent_team" {

The following arguments are supported:

* `team_id` - (Optional) The unique identifier for the team. If not provided, a UUID will be automatically generated. Once set, this value cannot be changed.

* `team_alias` - (Required) A human-readable identifier for the team.

* `organization_id` - (Optional) The ID of the organization this team belongs to.
Expand Down
17 changes: 16 additions & 1 deletion litellm/resource_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ func ResourceLiteLLMTeam() *schema.Resource {
Delete: resourceLiteLLMTeamDelete,

Schema: map[string]*schema.Schema{
"team_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: "The unique identifier for the team. If not provided, a UUID will be generated. Cannot be changed after creation.",
},
"team_alias": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -79,7 +86,14 @@ func ResourceLiteLLMTeam() *schema.Resource {
func resourceLiteLLMTeamCreate(d *schema.ResourceData, m interface{}) error {
client := m.(*Client)

teamID := uuid.New().String()
// Use provided team_id or generate a new UUID
var teamID string
if v, ok := d.GetOk("team_id"); ok {
teamID = v.(string)
} else {
teamID = uuid.New().String()
}

teamData := buildTeamData(d, teamID)

log.Printf("[DEBUG] Create team request payload: %+v", teamData)
Expand Down Expand Up @@ -123,6 +137,7 @@ func resourceLiteLLMTeamRead(d *schema.ResourceData, m interface{}) error {
}

// Update the state with values from the response or fall back to the data passed in during creation
d.Set("team_id", GetStringValue(teamResp.TeamID, d.Id()))
d.Set("team_alias", GetStringValue(teamResp.TeamAlias, d.Get("team_alias").(string)))
d.Set("organization_id", GetStringValue(teamResp.OrganizationID, d.Get("organization_id").(string)))

Expand Down