Skip to content

Commit

Permalink
fix(cognito-userpool): include user attribute update settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ekristen committed Dec 26, 2024
1 parent d7a7494 commit 0a4b89a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions resources/cognito-userpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,21 @@ type CognitoUserPool struct {

func (r *CognitoUserPool) Remove(_ context.Context) error {
if r.settings.GetBool("DisableDeletionProtection") {
_, err := r.svc.UpdateUserPool(&cognitoidentityprovider.UpdateUserPoolInput{
UserPoolId: r.ID,
DeletionProtection: ptr.String("INACTIVE"),
userPool, err := r.svc.DescribeUserPool(&cognitoidentityprovider.DescribeUserPoolInput{
UserPoolId: r.ID,
})
if err != nil {
return err
}

_, updateErr := r.svc.UpdateUserPool(&cognitoidentityprovider.UpdateUserPoolInput{
UserPoolId: r.ID,
DeletionProtection: ptr.String("INACTIVE"),
UserAttributeUpdateSettings: userPool.UserPool.UserAttributeUpdateSettings,
})
if updateErr != nil {
return updateErr
}
}

_, err := r.svc.DeleteUserPool(&cognitoidentityprovider.DeleteUserPoolInput{
Expand Down

0 comments on commit 0a4b89a

Please sign in to comment.