code cleanups
This commit is contained in:
parent
5f1ab2a953
commit
4d59019288
|
@ -124,7 +124,6 @@ func resourceAwsIamGroupMembershipDelete(d *schema.ResourceData, meta interface{
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId("")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ func testAccCheckAWSGroupMembershipDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
group := rs.Primary.Attributes["group"]
|
group := rs.Primary.Attributes["group"]
|
||||||
|
|
||||||
_, err := conn.GetGroup(&iam.GetGroupInput{
|
resp, err := conn.GetGroup(&iam.GetGroupInput{
|
||||||
GroupName: aws.String(group),
|
GroupName: aws.String(group),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -55,7 +55,14 @@ func testAccCheckAWSGroupMembershipDestroy(s *terraform.State) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("Error: Group (%s) still exists", group)
|
users := []string{"test-user", "test-user-two", "test-user-three"}
|
||||||
|
for _, u := range resp.Users {
|
||||||
|
for _, i := range users {
|
||||||
|
if i == *u.UserName {
|
||||||
|
return fmt.Errorf("Error: User (s) still a member of Group (%s)", i, *resp.Group.GroupName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue