check for empty string instead of nil

This commit is contained in:
Patrick Gray 2015-06-28 19:39:50 -04:00
parent 8abca07889
commit c375a72f15
1 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ func resourceAwsIamPolicyAttachmentCreate(d *schema.ResourceData, meta interface
roles := expandStringList(d.Get("roles").(*schema.Set).List()) roles := expandStringList(d.Get("roles").(*schema.Set).List())
groups := expandStringList(d.Get("groups").(*schema.Set).List()) groups := expandStringList(d.Get("groups").(*schema.Set).List())
if users == nil && roles == nil && groups == nil { if users == "" && roles == "" && groups == "" {
return fmt.Errorf("[WARN] No Users, Roles, or Groups specified for %s", name) return fmt.Errorf("[WARN] No Users, Roles, or Groups specified for %s", name)
} else { } else {
var userErr, roleErr, groupErr error var userErr, roleErr, groupErr error
@ -161,13 +161,13 @@ func resourceAwsIamPolicyAttachmentDelete(d *schema.ResourceData, meta interface
groups := expandStringList(d.Get("groups").(*schema.Set).List()) groups := expandStringList(d.Get("groups").(*schema.Set).List())
var userErr, roleErr, groupErr error var userErr, roleErr, groupErr error
if users != nil { if users != "" {
userErr = detachPolicyFromUsers(conn, users, arn) userErr = detachPolicyFromUsers(conn, users, arn)
} }
if roles != nil { if roles != "" {
roleErr = detachPolicyFromRoles(conn, roles, arn) roleErr = detachPolicyFromRoles(conn, roles, arn)
} }
if groups != nil { if groups != "" {
groupErr = detachPolicyFromGroups(conn, groups, arn) groupErr = detachPolicyFromGroups(conn, groups, arn)
} }
if userErr != nil || roleErr != nil || groupErr != nil { if userErr != nil || roleErr != nil || groupErr != nil {