Skip to content

Commit

Permalink
XXX Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
zshamrock committed Mar 2, 2021
1 parent 9da2a47 commit 7914aeb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,21 @@ func syncSecurityGroupInboundRule(
if err != nil {
return err
}
descriptionId := buildDescriptionId(username, location)
for _, group := range groups {
revoked := false
for _, inbound := range group.IpPermissions {
if revoked {
break
}
for _, entry := range inbound.IpRanges {
if aws.StringValue(entry.Description) == fmt.Sprintf("%s-%s", username, location) {
if aws.StringValue(entry.Description) == descriptionId {
err := revokeSecurityGroupIngress(svc, groupName, port, aws.StringValue(entry.CidrIp), username, location)
if err != nil {
return err
}
revoked = true
break
}
}
}
Expand Down

0 comments on commit 7914aeb

Please sign in to comment.