Skip to content

Commit

Permalink
🧹 Do not discover azure vms twice.
Browse files Browse the repository at this point in the history
Signed-off-by: Preslav <preslav@mondoo.com>
  • Loading branch information
preslavgerchev committed May 13, 2024
1 parent 81a67cc commit 4579dac
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions providers/azure/resources/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func Discover(runtime *plugin.Runtime, rootConf *inventory.Config) (*inventory.I
if ENABLE_FINE_GRAINED_ASSETS {
matchingTargets = append(matchingTargets, DiscoveryAuto)
}
if stringx.ContainsAnyOf(targets, append(matchingTargets, DiscoveryInstances)...) {
// FIXME: do not discover instances as OSes right now, only discover as API representations.
if stringx.ContainsAnyOf(targets, DiscoveryInstances) {
vms, err := discoverInstances(runtime, subsWithConfigs)
if err != nil {
return nil, err
Expand Down Expand Up @@ -723,8 +724,10 @@ func mqlObjectToAsset(mqlObject mqlObject, conf *inventory.Config, subWithConf s
tenantId = *subWithConf.sub.TenantID
}

assetUrl := []string{"azure", tenantId, mqlObject.azureObject.subscription,
mqlObject.azureObject.service}
assetUrl := []string{
"azure", tenantId, mqlObject.azureObject.subscription,
mqlObject.azureObject.service,
}
if includeObjectTypeInUrl {
assetUrl = append(assetUrl, mqlObject.azureObject.objectType)
}
Expand Down

0 comments on commit 4579dac

Please sign in to comment.