Skip to content

Commit

Permalink
fix: missing tenantId on user api token
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Aug 12, 2024
1 parent be6812c commit 68c9f60
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/provider/resource_user_api_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ func resourceUserApiTokenCreate(ctx context.Context, d *schema.ResourceData, met
}

userId := d.Get("user_id").(string)
tenantId := c.TenantId

r, reqErr := c.request("POST", fmt.Sprintf("%s/users/%s/api-tokens", apiRoot(nil), userId), body)
r, reqErr := c.request("POST", fmt.Sprintf("%s/users/%s/api-tokens", apiRoot(tenantId), userId), body)
if reqErr != nil {
return diag.FromErr(reqErr.Err)
}
Expand Down Expand Up @@ -115,8 +116,9 @@ func resourceUserApiTokenDelete(ctx context.Context, d *schema.ResourceData, met

tokenId := d.Id()
userId := d.Get("user_id").(string)
tenantId := c.TenantId

_, reqErr := c.request("DELETE", fmt.Sprintf("%s/users/%s/api-tokens/%s", apiRoot(nil), userId, tokenId), nil)
_, reqErr := c.request("DELETE", fmt.Sprintf("%s/users/%s/api-tokens/%s", apiRoot(tenantId), userId, tokenId), nil)
if reqErr != nil {
return diag.FromErr(reqErr.Err)
}
Expand Down

0 comments on commit 68c9f60

Please sign in to comment.