Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove force_destroy check from user update to prevent unintended deletions #591

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading