Skip to content

Conversation

@BCook98
Copy link

@BCook98 BCook98 commented Nov 12, 2025

This commit adds import functionality to five LiteLLM resources using schema.ImportStatePassthroughContext, which passes the resource ID directly to the Read function during import operations.

Resources updated:

  • litellm_key: Import using key ID
  • litellm_model: Import using model ID
  • litellm_mcp_server: Import using server ID
  • litellm_team: Import using team ID
  • litellm_vector_store: Import using vector store ID

All resources already have proper Read functions that:

  • Fetch resources by ID from the API
  • Handle 404/not-found cases gracefully
  • Populate state with all attributes

Documentation already includes import instructions for all resources.

Usage:
terraform import litellm_key.example
terraform import litellm_model.example
terraform import litellm_mcp_server.example
terraform import litellm_team.example
terraform import litellm_vector_store.example

🤖 Generated with Claude Code

This commit adds import functionality to five LiteLLM resources using
schema.ImportStatePassthroughContext, which passes the resource ID
directly to the Read function during import operations.

Resources updated:
- litellm_key: Import using key ID
- litellm_model: Import using model ID
- litellm_mcp_server: Import using server ID
- litellm_team: Import using team ID
- litellm_vector_store: Import using vector store ID

All resources already have proper Read functions that:
- Fetch resources by ID from the API
- Handle 404/not-found cases gracefully
- Populate state with all attributes

Documentation already includes import instructions for all resources.

Usage:
  terraform import litellm_key.example <key-id>
  terraform import litellm_model.example <model-id>
  terraform import litellm_mcp_server.example <server-id>
  terraform import litellm_team.example <team-id>
  terraform import litellm_vector_store.example <vector-store-id>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@BCook98
Copy link
Author

BCook98 commented Nov 12, 2025

I've published this as https://registry.terraform.io/providers/BCook98/litellm/0.4.0-alpha.3, if you'd like to test prior to merging.

@BCook98 BCook98 closed this Nov 12, 2025
Updates the team resource Read function to correctly access team data
from the TeamInfo nested structure in the API response.

Changes:
- Update TeamResponse type to include TeamInfo nested struct
- Modify resourceLiteLLMTeamRead to access fields via teamResp.TeamInfo
- Ensures compatibility with the actual API response structure

This fix ensures the import functionality works correctly with the
actual API response format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@BCook98 BCook98 reopened this Nov 12, 2025
// TeamResponse represents a response from the API containing team information.
type TeamResponse struct {
TeamID string `json:"team_id,omitempty"`
TeamInfo TeamInfo `json:"team_info,omitempty"`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also appears to have changed in the LiteLLM API since this terraform provider was implemented.

With

# (imported from "55de53d4-da3c-430a-bba3-8e0c847d37a8")
~ resource "litellm_team" "<redacted>" {
--
  | blocked                 = false
  | ~ budget_duration         = "24h" -> "30d"
  | id                      = "55de53d4-da3c-430a-bba3-8e0c847d37a8"
  | ~ max_budget              = 0 -> 100
  | + metadata                = {
  | + "environment" = "development"
  | + "managed_by"  = "terraform"
  | + "team"        = "<redacted>"
  | }
  | models                  = [
  | "all-proxy-models",
  | ]
  | organization_id         = null
  | rpm_limit               = 0
  | team_alias              = "<redacted>"
  | team_member_permissions = []
  | tpm_limit               = 0
  | }

Without

# (imported from "55de53d4-da3c-430a-bba3-8e0c847d37a8")
--
  | ~ resource "litellm_team" "<redacted>" {
  | blocked                 = false
  | + budget_duration         = "30d"
  | id                      = "55de53d4-da3c-430a-bba3-8e0c847d37a8"
  | ~ max_budget              = 0 -> 100
  | ~ metadata                = {
  | + "environment" = "development"
  | + "managed_by"  = "terraform"
  | + "team"        = "<redacted>"
  | }
  | ~ models                  = [
  | + "all-proxy-models",
  | ]
  | organization_id         = null
  | rpm_limit               = 0
  | + team_alias              = "<redacted>"
  | team_member_permissions = []
  | tpm_limit               = 0
  | }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant