diff --git a/docs/resources/team.md b/docs/resources/team.md index 6853530..02a81e4 100644 --- a/docs/resources/team.md +++ b/docs/resources/team.md @@ -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"] @@ -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. diff --git a/litellm/resource_team.go b/litellm/resource_team.go index f412c28..9fa7573 100644 --- a/litellm/resource_team.go +++ b/litellm/resource_team.go @@ -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, @@ -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) @@ -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)))