ekristen / azure-nuke

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

Segfault with --no-dry-run #52

Closed andrewfraley closed 8 months ago

andrewfraley commented 8 months ago

@ekristen thanks again for the help yesterday. I have a new issue with a segfault. Note I've omitted trace output, but there's no additional logging that happens after "scan complete..." and the panic.

config.yaml

regions:
    - eastus

blocklist:
    - fake-tenant-id

accounts:
    redacted-tenant-id:
        filters:
            ResourceGroup:
                - Default
                - NetworkWatcherRG
            PolicyAssignment:
                - SecurityCenterBuiltIn

--no-dry-run output:

INFO[0000] configured locations[eastus]

eastus/rg0 - ResourceGroup - delete-me_group - [Location: "eastus", Name: "delete-me_group"] - would remove
eastus/rg0 - ResourceGroup - deleteme - [Location: "eastus", Name: "deleteme"] - would remove
eastus/rg0 - VirtualNetwork - delete-me-vnet - [Name: "delete-me-vnet", ResourceGroup: "delete-me_group"] - would remove
eastus/rg0 - SSHPublicKey - somekey - [Name: "somekey", ResourceGroup: "delete-me_group"] - would remove
eastus/rg0 - NetworkSecurityGroup - delete-me-nsg - [Location: "eastus", Name: "delete-me-nsg"] - would remove
eastus/rg0 - VirtualMachine - delete-me - [Name: "delete-me", ResourceGroup: "delete-me_group"] - would remove
eastus/rg0 - NetworkInterface - delete-me293_z1 - [Name: "delete-me293_z1", ResourceGroup: "delete-me_group"] - would remove
eastus/rg0 - PublicIPAddresses - delete-me-ip - [Name: "delete-me-ip", ResourceGroup: "delete-me_group"] - would remove
eastus/rg0 - Disk - delete-me_disk1_23497234987234hjsdf - [Name: "delete-me_disk1_23497234987234hjsdf", ResourceGroup: "delete-me_group"] - would remove
eastus/rg1 - ResourceGroup - delete-me_group - [Location: "eastus", Name: "delete-me_group"] - would remove
eastus/rg1 - ResourceGroup - deleteme - [Location: "eastus", Name: "deleteme"] - would remove
eastus/rg2 - ResourceGroup - delete-me_group - [Location: "eastus", Name: "delete-me_group"] - would remove
eastus/rg2 - ResourceGroup - deleteme - [Location: "eastus", Name: "deleteme"] - would remove
Scan complete: 3123 total, 13 nukeable, 3110 filtered.

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x19cc742]

goroutine 1 [running]:
main.main.func1()
    /home/runner/work/azure-nuke/azure-nuke/main.go:25 +0x54
panic({0x1adac40?, 0x2405950?})
    /opt/hostedtoolcache/go/1.21.6/x64/src/runtime/panic.go:914 +0x21f
github.com/ekristen/azure-nuke/resources.(*ResourceGroup).Remove(0x38?, {0x1d3f880?, 0x2448840?})
    /home/runner/work/azure-nuke/azure-nuke/resources/resource-group.go:38 +0x22
github.com/ekristen/libnuke/pkg/nuke.(*Nuke).HandleRemove(0xc0001a8f50?, {0x1d3f880?, 0x2448840?}, 0xc00150e840)
    /home/runner/go/pkg/mod/github.com/ekristen/libnuke@v0.6.0/pkg/nuke/nuke.go:474 +0x2e
github.com/ekristen/libnuke/pkg/nuke.(*Nuke).HandleQueue(0xc000213400, {0x1d3f880, 0x2448840})
    /home/runner/go/pkg/mod/github.com/ekristen/libnuke@v0.6.0/pkg/nuke/nuke.go:436 +0x105
github.com/ekristen/libnuke/pkg/nuke.(*Nuke).run(0xc000213400, {0x1d3f880, 0x2448840})
    /home/runner/go/pkg/mod/github.com/ekristen/libnuke@v0.6.0/pkg/nuke/nuke.go:225 +0x85
github.com/ekristen/libnuke/pkg/nuke.(*Nuke).Run(0xc000213400, {0x1d3f880, 0x2448840})
    /home/runner/go/pkg/mod/github.com/ekristen/libnuke@v0.6.0/pkg/nuke/nuke.go:209 +0x17a
github.com/ekristen/azure-nuke/pkg/commands/nuke.execute(0xc0001dac40)
    /home/runner/work/azure-nuke/azure-nuke/pkg/commands/nuke/command.go:183 +0x1cc5
github.com/urfave/cli/v2.(*Command).Run(0xc00014a6c0, 0xc0001da600)
    /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x583
github.com/urfave/cli/v2.(*App).RunContext(0xc00020ed00, {0x1d3f880?, 0x2448840}, {0xc000022100, 0x8, 0x8})
    /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0xaa5
github.com/urfave/cli/v2.(*App).Run(...)
    /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
    /home/runner/work/azure-nuke/azure-nuke/main.go:45 +0x20d
ekristen commented 8 months ago

Odd, I'll take a look first thing and get back to you, thanks for the issue.

ekristen commented 8 months ago

:tada: This issue has been resolved in version 1.0.0-next.5 :tada:

The release is available on GitHub release :rocket:

ekristen commented 7 months ago

:tada: This issue has been resolved in version 1.0.0-beta.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

ekristen commented 5 months ago

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: