Merge pull request #9583 from hashicorp/aws-iam-delete-force_destroy

provider/aws: Delete Loging Profile from IAM User on force_destroy
This commit is contained in:
Paul Stack 2016-10-25 14:14:49 +01:00 committed by GitHub
commit df18307662
1 changed files with 10 additions and 0 deletions

View File

@ -190,6 +190,16 @@ func resourceAwsIamUserDelete(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error deleting access key %s: %s", k, err) return fmt.Errorf("Error deleting access key %s: %s", k, err)
} }
} }
_, err = iamconn.DeleteLoginProfile(&iam.DeleteLoginProfileInput{
UserName: aws.String(d.Id()),
})
if err != nil {
if iamerr, ok := err.(awserr.Error); ok && iamerr.Code() == "NoSuchEntity" {
return nil
}
return fmt.Errorf("Error deleting Account Login Profile: %s", err)
}
} }
request := &iam.DeleteUserInput{ request := &iam.DeleteUserInput{