Skip to content

Commit

Permalink
Remove force_destroy check from user update to prevent unintended d…
Browse files Browse the repository at this point in the history
…eletions (#591)
  • Loading branch information
felladrin authored Nov 9, 2024
1 parent 2319dd3 commit d1a9ab6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
18 changes: 8 additions & 10 deletions docs/resources/iam_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
page_title: "minio_iam_user Resource - terraform-provider-minio"
subcategory: ""
description: |-
---

# minio_iam_user (Resource)



## Example Usage

```terraform
Expand All @@ -35,6 +32,7 @@ output "secret" {
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand All @@ -43,13 +41,13 @@ output "secret" {

### Optional

- `disable_user` (Boolean) Disable user
- `force_destroy` (Boolean) Delete user even if it has non-Terraform-managed IAM access keys
- `secret` (String, Sensitive)
- `tags` (Map of String)
- `update_secret` (Boolean) Rotate Minio User Secret Key
- `force_destroy` (Boolean) Delete user even if it has non-Terraform-managed IAM access keys or group memberships. When true, any group memberships will be removed during deletion even if they cause errors.
- `disable_user` (Boolean) Disable user access. Defaults to false.
- `update_secret` (Boolean) When true, generates a new secret key for the user. Defaults to false.
- `secret` (String, Sensitive) The user's secret key. If not provided, one will be generated. Can be updated.
- `tags` (Map of String) Key-value map of tags.

### Read-Only

- `id` (String) The ID of this resource.
- `status` (String)
- `id` (String) The ID of this resource (same as name).
- `status` (String) Current status of the user (enabled/disabled).
4 changes: 0 additions & 4 deletions minio/resource_minio_iam_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ func minioUpdateUser(ctx context.Context, d *schema.ResourceData, meta interface
wantedStatus = madmin.AccountDisabled
}

if iamUserConfig.MinioForceDestroy {
return minioDeleteUser(ctx, d, meta)
}

userServerInfo, _ := iamUserConfig.MinioAdmin.GetUserInfo(ctx, iamUserConfig.MinioIAMName)
if userServerInfo.Status != wantedStatus {
err := iamUserConfig.MinioAdmin.SetUserStatus(ctx, iamUserConfig.MinioIAMName, wantedStatus)
Expand Down

0 comments on commit d1a9ab6

Please sign in to comment.