ekristen / azure-nuke

Remove all resources from an Azure Tenant and it's Subscriptions.
https://ekristen.github.io/azure-nuke/
MIT License
32 stars 8 forks source link

Exclude resources owned by resource group #31

Closed fergoid closed 7 months ago

fergoid commented 1 year ago

At the moment resource group exclusions will prevent the group being destroyed but owned resources are still flagged for destruction. Could we add an option to also exclude the resources owned by the group? Something like: Filters: ResourceGroup:

so current the exclusions filter method is unaffected by the change .

ekristen commented 1 year ago

I'm not sure I follow the request, it seems you want to exclude resources by membership to a resource group? If that's the ask, shouldn't just excluding the resource group itself (which is already supported) not solve this?

fergoid commented 1 year ago

I am sure when I tried earlier it was flagging the group as retained but the resources for deletion. Let me double check and I will get back to you.

I will close the issue if I got it wrong. 😀

ekristen commented 1 year ago

Ah, I think you are right. I follow what you are asking now. Let me check on a couple things.

ekristen commented 1 year ago

Unfortunately the tool doesn't support global filters yet, but this should work, I just can't test at the moment. ResourceGroup property is set on every resource.

tenants:
  77776666-5555-4444-3333-222211110000:
    presets:
      - common
    filters:
      SomeRGResourceType:
        - property: ResourceGroup
          type: contains
          value: <rg-name>
fergoid commented 1 year ago

I'd be happy to try implementing it if you are okay with that?

ekristen commented 1 year ago

Pull Requests are welcome, might require back and forth. Are you asking about implementing Global Filters?

ekristen commented 7 months ago

This tool is being completely rewritten to use my new libnuke library. I've got an open issue over there to figure out how to best implement global filters. https://github.com/ekristen/libnuke/issues/25