-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🧹 Remove discovery filters parameter from Discover #4691
Conversation
…ilters from AwsConnection. Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
All contributors have signed the CLA ✍️ ✅ |
Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
I have read the Mondoo CLA Document and I hereby sign the CLA |
Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
providers/aws/resources/aws_ec2.go
Outdated
@@ -803,6 +803,9 @@ func (a *mqlAwsEc2) getInstances(conn *connection.AwsConnection) []*jobpool.Job | |||
if len(conn.Filters.Ec2DiscoveryFilters.Regions) > 0 { | |||
regions = conn.Filters.Ec2DiscoveryFilters.Regions | |||
} | |||
for _, regionToExclude := range conn.Filters.Ec2DiscoveryFilters.ExcludeRegions { | |||
regions = removeElement(regions, regionToExclude) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just adjust this to a single function that takes the regions and the regions to exclude and returns a new list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this lgtm! @vjeffrey can you have another look since we're changing the AWS discovery here?
… should be queried. Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
…cable. Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
…map and implement parsing of CLI flags to opts matching them to known filter prefixes. Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
After a chat with Preslav, we decided it'd be nicer to have the filters as comma separated values as opposed to individual keys. Also, added the parsing of CLI flags to opts and now the CLI should have the same functionality. |
Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
… longer embed the value into the key. Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
…ven region but propagate an error when we attempt to find it from another region it is not in. Signed-off-by: Vasil Sirakov <sirakov97@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thank you!
In this PR:
DiscoveryFilters
fromDiscover(...)
function and use the parameters from theAwsConnection
instead.DiscoveryFilters
struct.Discovery(...)
.GetInstances()
.Ec2DiscoveryFilters
.ExcludeRegions
happens before the call to AWS,ExcludeTags
andExcludeInstanceIds
happen after (AWS doesn't support server-side filtering for those).Note:
Changing the signature for
Discovery
means everyone using the AWS provider and wanting to filter discovered instances must specify these filters in their inventory config discovery filters map.