Skip to content

Commit eafae9a

Browse files
committed
Add a log statement for exluded AWS group
1 parent 2a17a47 commit eafae9a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/fac/extensions.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"regexp"
88

99
"github.com/awslabs/ssosync/internal/aws"
10+
log "github.com/sirupsen/logrus"
1011
)
1112

1213
// ErrNoAWSGroups indicates no AWS groups were received.
@@ -25,7 +26,7 @@ func (e ErrorBadRegex) Error() string {
2526
// MatchAWSGroups will filter out the AWS groups that don't match the regex.
2627
// Returns an error on failure, a list of AWS groups that match on success.
2728
func MatchAWSGroups(awsGroups []*aws.Group, matchRegex string) ([]*aws.Group, error) {
28-
if awsGroups == nil || len(awsGroups) == 0 {
29+
if len(awsGroups) == 0 {
2930
return nil, ErrNoAWSGroups
3031
}
3132

@@ -36,9 +37,12 @@ func MatchAWSGroups(awsGroups []*aws.Group, matchRegex string) ([]*aws.Group, er
3637

3738
matchedGroups := make([]*aws.Group, 0)
3839
for _, group := range awsGroups {
39-
if awsGroupRegex.FindStringIndex(group.DisplayName) != nil {
40-
matchedGroups = append(matchedGroups, group)
40+
if awsGroupRegex.FindStringIndex(group.DisplayName) == nil {
41+
log.Infof("AWS group %s will not be included in sync", group.DisplayName)
42+
continue
4143
}
44+
45+
matchedGroups = append(matchedGroups, group)
4246
}
4347

4448
return matchedGroups, nil

0 commit comments

Comments
 (0)