Skip to content

Commit

Permalink
fix(access_keys): fix removal of access keys
Browse files Browse the repository at this point in the history
  • Loading branch information
dmpe committed Feb 3, 2025
1 parent 51d35d3 commit 8c52036
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.3.0

Bug Fix:

- An attempt to fix [this issue](https://github.com/dmpe/terraform-provider-storagegrid/issues/9) as reported by @bajo. Thanks.


## 1.2.0

FEATURES:
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/s3_keys_by_user_id_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ func (r *s3AccessSecretKeyResource) Update(ctx context.Context, req resource.Upd
}

func (r *s3AccessSecretKeyResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
var state UserIDS3AccessSecretKeysModel
var state S3AccessKeyResourceModel
diags := req.State.Get(ctx, &state)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}

// in order for us to delete it, we first need to retrieve user id and access key
_, _, _, err := r.client.SendRequest("DELETE", api_users+"/"+state.UserUUID.ValueString()+api_s3_suffix+"/"+state.Data.AccessKey.ValueString(), nil, 204)
_, _, _, err := r.client.SendRequest("DELETE", api_users+"/"+state.UserUUID.ValueString()+api_s3_suffix+"/"+state.AccessKey.ValueString(), nil, 204)
if err != nil {
resp.Diagnostics.AddError(
"Error Deleting StorageGrid access keys",
Expand Down

0 comments on commit 8c52036

Please sign in to comment.