@@ -57,9 +57,9 @@ func resourceOpenAIProjectUser() *schema.Resource {
5757 }
5858}
5959
60- // findProjectUserWithPagination finds a user in a project by ID with automatic pagination.
60+ // findProjectUser finds a user in a project by ID with automatic pagination.
6161// This helper function ensures we search through all pages of users to properly detect drift.
62- func findProjectUserWithPagination (ctx context.Context , c interface {}, projectID , userID string ) (* client.ProjectUser , bool , error ) {
62+ func findProjectUser (ctx context.Context , c interface {}, projectID , userID string ) (* client.ProjectUser , bool , error ) {
6363 clientInstance , err := GetOpenAIClientWithAdminKey (c )
6464 if err != nil {
6565 return nil , false , err
@@ -118,7 +118,7 @@ func resourceOpenAIProjectUserCreate(ctx context.Context, d *schema.ResourceData
118118
119119 // First check if the user is already in the project
120120 tflog .Debug (ctx , fmt .Sprintf ("Checking if user %s already exists in project %s" , userID , projectID ))
121- existingUser , exists , err := findProjectUserWithPagination (ctx , m , projectID , userID )
121+ existingUser , exists , err := findProjectUser (ctx , m , projectID , userID )
122122 if err != nil {
123123 tflog .Error (ctx , fmt .Sprintf ("Error checking if user exists: %v" , err ))
124124 return diag .Errorf ("Error checking if user exists in project: %s" , err )
@@ -155,7 +155,7 @@ func resourceOpenAIProjectUserCreate(ctx context.Context, d *schema.ResourceData
155155 tflog .Info (ctx , fmt .Sprintf ("User %s already exists in project, continuing: %s" , userID , err ))
156156
157157 // Try to get user details again
158- existingUser , exists , findErr := findProjectUserWithPagination (ctx , m , projectID , userID )
158+ existingUser , exists , findErr := findProjectUser (ctx , m , projectID , userID )
159159 if findErr == nil && exists {
160160 // Update the Terraform state with values from the existing user
161161 if err := d .Set ("email" , existingUser .Email ); err != nil {
@@ -205,7 +205,7 @@ func resourceOpenAIProjectUserRead(ctx context.Context, d *schema.ResourceData,
205205
206206 // Check if the user exists in the project
207207 tflog .Debug (ctx , fmt .Sprintf ("Checking if user %s exists in project %s" , userID , projectID ))
208- existingUser , exists , err := findProjectUserWithPagination (ctx , m , projectID , userID )
208+ existingUser , exists , err := findProjectUser (ctx , m , projectID , userID )
209209 if err != nil {
210210 // If it's a permissions error, just keep the state
211211 if strings .Contains (err .Error (), "insufficient permissions" ) {
@@ -411,7 +411,7 @@ func resourceOpenAIProjectUserImport(ctx context.Context, d *schema.ResourceData
411411 }
412412
413413 // Find the user in the project to get additional details
414- existingUser , exists , err := findProjectUserWithPagination (ctx , m , projectID , userID )
414+ existingUser , exists , err := findProjectUser (ctx , m , projectID , userID )
415415 if err != nil {
416416 return nil , fmt .Errorf ("error retrieving project user: %s" , err )
417417 }
0 commit comments