From 68c9f6023b7602481d4d0b499608a86b408a3645 Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Mon, 12 Aug 2024 12:11:15 +0200 Subject: [PATCH] fix: missing tenantId on user api token --- internal/provider/resource_user_api_token.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/provider/resource_user_api_token.go b/internal/provider/resource_user_api_token.go index 297e962..3a91815 100644 --- a/internal/provider/resource_user_api_token.go +++ b/internal/provider/resource_user_api_token.go @@ -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) } @@ -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) }