Skip to content

Conversation

@runixer
Copy link

@runixer runixer commented Aug 29, 2025

Hi,

This pull request fixes a race condition in the retryModelRead function that caused the Terraform provider to fail in multi-node environments with the error Provider produced inconsistent result after apply.

In a distributed setup with replication lag, a Read operation immediately following a Create could target a node that had not yet received the new resource data. The provider would interpret the resulting "not found" API error as the resource being deleted, clearing its ID from the Terraform state (d.SetId("")).

The changes in litellm/resource_model_crud.go address this by:
Storing the model's ID before entering the retry loop.
Removing the brittle hardcoded error string check for "model not found".
If the retry loop completes without successfully reading the model, the original ID is restored to the resource data (d.SetId(model_id)).

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