Skip to content

Recreate flow reuses deleted resource IDs after team update #12

@hassanraha

Description

@hassanraha

In the litellm Terraform setup, changing certain immutable attributes (for example, a team name) causes Terraform to recreate dependent resources, which is expected behavior.

However, during this recreate flow, Terraform destroys the existing resources successfully, but then attempts to reference the same (now destroyed) resource IDs during the creation phase. Since these IDs no longer exist in Light LLM, the apply fails.

team_resource.teams["team-A"]: Destroying... [id=<redacted>]
team_resource.teams["team-B"]: Destroying... [id=<redacted>]
team_resource.teams["team-A-new"]: Creating...
team_resource.teams["team-B-new"]: Creating...

team_resource.teams["team-B"]: Destruction complete after 1s
team_resource.teams["team-A"]: Destruction complete after 1s

team_resource.teams["team-A-new"]: Creation complete after 2s [id=<new-id>]
team_resource.teams["team-B-new"]: Creation complete after 2s [id=<new-id>]

api_key.service_account["service-account-1"]: Modifying... [id=<redacted-key>]
api_key.service_tokens["service-token-1"]: Modifying... [id=<redacted-key>]
api_key.service_tokens["service-token-2"]: Modifying... [id=<redacted-key>]
api_key.service_tokens["service-token-3"]: Modifying... [id=<redacted-key>]
api_key.service_tokens["service-token-4"]: Modifying... [id=<redacted-key>]

╷
│ Error: error updating key: API request failed with status code 401
│ Response:
│ {
│   "error": {
│     "message": "Authentication Error: invalid user key - user key does not exist in database",
│     "type": "auth_error",
│     "code": "401"
│   }
│ }
│
│   with api_key.service_tokens["service-token-3"],
│   on service_tokens.tf line 70
╵

╷
│ Error: error updating key: API request failed with status code 401
│ Response:
│ {
│   "error": {
│     "message": "Authentication Error: invalid user key - user key does not exist in database",
│     "type": "auth_error",
│     "code": "401"
│   }
│ }
│
│   with api_key.service_account["service-account-1"],
│   on user_tokens.tf line 65
╵

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions