Skip to content
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

⭐️ Add azure.subscription. Move all azure resources under azure.subscription #810

Merged
merged 7 commits into from
Feb 8, 2023

Conversation

preslavgerchev
Copy link
Contributor

Introduce a new azure.subscription resource:

cnquery> azure.subscription{name state}
azure.subscription: {
  name: "Mondoo Testing"
  state: "Enabled"
}

All the resources are now moved from azure.* to azure.subscription.*. This lets us build a resource hierarchy more clearly. Before:


cnquery> azure.compute.vms{name}
azure.compute.vms: [
  0: {
    name: "Security-Team-vm-linux-1-b9qa"
  }
  1: {
    name: "Security-Team-vm-linux-1-mjau"
  }
]

After:

cnuery> azure.subscription.compute.vms{name}
azure.subscription.compute.vms: [
  0: {
    name: "Security-Team-vm-linux-1-b9qa"
  }
  1: {
    name: "Security-Team-vm-linux-1-mjau"
  }
]

There are aliases introduced to keep the old resources untouched to avoid breaking changes so azure.compute.vms will still work

@preslavgerchev preslavgerchev requested a review from a team as a code owner January 21, 2023 08:25
@github-actions

This comment has been minimized.

resources/packs/azure/azure.lr Outdated Show resolved Hide resolved
resources/packs/azure/azure.lr Show resolved Hide resolved
@imilchev
Copy link
Member

This does mean that when we introduce the individual assets (not sure if that's already present for Azure) you will face the following issue:

  • you will be listing VMs with:
    azure.subscription.compute.vms
    
  • you will be querying 1 VM with:
    azure.subscription.computeService.vm
    

If you try to change azure.subscription.computeService.vm to azure.subscription.compute.vm it will result in an MQL runtime error. I have the same problem for GCP resources. Still need to look into how to make MQL work with both azure.subscription.compute.vms() and azure.subscription.compute.vm

@preslavgerchev preslavgerchev force-pushed the preslav/azure-sub branch 3 times, most recently from b6552f7 to 1aec447 Compare February 2, 2023 12:33
Copy link
Member

@imilchev imilchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks similar to what we have for GCP

Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @preslavgerchev

@preslavgerchev preslavgerchev merged commit 3339aa2 into main Feb 8, 2023
@preslavgerchev preslavgerchev deleted the preslav/azure-sub branch February 8, 2023 16:42
@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants