Skip to content

Commit f54c0dc

Browse files
authored
fix(project_token): ensure correct token is deleted (#294)
1 parent 6e7334d commit f54c0dc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

argocd/resource_argocd_project_token.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,19 +362,18 @@ func resourceArgoCDProjectTokenDelete(ctx context.Context, d *schema.ResourceDat
362362
}
363363

364364
projectName := d.Get("project").(string)
365-
role := d.Get("role").(string)
366-
opts := &project.ProjectTokenDeleteRequest{
367-
Project: projectName,
368-
Role: role,
369-
}
370365

371366
if _, ok := tokenMutexProjectMap[projectName]; !ok {
372367
tokenMutexProjectMap[projectName] = &sync.RWMutex{}
373368
}
374369

375370
tokenMutexProjectMap[projectName].Lock()
376371

377-
_, err := si.ProjectClient.DeleteToken(ctx, opts)
372+
_, err := si.ProjectClient.DeleteToken(ctx, &project.ProjectTokenDeleteRequest{
373+
Id: d.Id(),
374+
Project: projectName,
375+
Role: d.Get("role").(string),
376+
})
378377

379378
tokenMutexProjectMap[projectName].Unlock()
380379

0 commit comments

Comments
 (0)