provider/aws: Fix bug #9863 destroying aws_iam_user with force_destroy does not work (#9900)

This commit is contained in:
Masayuki Morita 2016-11-07 19:37:32 +09:00 committed by Paul Stack
parent 517d319c2c
commit f68d5e82f3
1 changed files with 2 additions and 3 deletions

View File

@ -197,12 +197,11 @@ func resourceAwsIamUserDelete(d *schema.ResourceData, meta interface{}) error {
UserName: aws.String(d.Id()), UserName: aws.String(d.Id()),
}) })
if err != nil { if err != nil {
if iamerr, ok := err.(awserr.Error); ok && iamerr.Code() == "NoSuchEntity" { if iamerr, ok := err.(awserr.Error); !ok || iamerr.Code() != "NoSuchEntity" {
return nil
}
return fmt.Errorf("Error deleting Account Login Profile: %s", err) return fmt.Errorf("Error deleting Account Login Profile: %s", err)
} }
} }
}
request := &iam.DeleteUserInput{ request := &iam.DeleteUserInput{
UserName: aws.String(d.Id()), UserName: aws.String(d.Id()),