Skip to content

Commit

Permalink
Handle usergroup already exists error (#71)
Browse files Browse the repository at this point in the history
Thank you so much, the provider has nice handling when a deactivated usergroup exists. But looks like slack changed the error message in the API. The error thrown is now called `handle_already_exists`:

```

│ Error: could not create usergroup <xxxxx>: handle_already_exists
│ 
│   with slack_usergroup.<xxxxx>,
│   on gen_slack.tf line 1867, in resource "slack_usergroup" "<xxxxx>":
│ 1867:   resource "slack_usergroup" "<xxxxx>" {
```
  • Loading branch information
rdsubhas authored Oct 1, 2021
1 parent e238f56 commit ffa5f07
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slack/resource_usergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func resourceSlackUserGroupCreate(ctx context.Context, d *schema.ResourceData, m
}
createdUserGroup, err := client.CreateUserGroupContext(ctx, userGroup)
if err != nil {
if err.Error() != "name_already_exists" {
if err.Error() != "name_already_exists" && err.Error() != "handle_already_exists" {
return diag.Errorf("could not create usergroup %s: %s", name, err)
}
group, err := findUserGroupByName(ctx, name, true, m)
Expand Down

0 comments on commit ffa5f07

Please sign in to comment.