ekristen / aws-nuke

Remove all the resources from an AWS account
https://ekristen.github.io/aws-nuke/
MIT License
256 stars 26 forks source link

nil pointer dereference #321

Closed eaudetcobello closed 2 months ago

eaudetcobello commented 2 months ago

This is fixed by adding {} after the account number colon.

❯ cat ~/.config/aws-nuke/nuke-config.yaml 
regions:
  - us-east-2

blocklist:
  - "999999999999" # A blocklist is required, but this is a placeholder

accounts:
  <12 digits>:

resource-types:
    includes:
    - EC2Instance
    - EC2SecurityGroup
    - EC2Volume
    - EC2InternetGateway
    - EC2NATGateway
    - EC2RouteTable
    - EC2Subnet
    - EC2VPC
    - EC2VPCEndpoint
    - EC2VPCEndpointServiceConfiguration
    - EC2ElasticIP
    - EC2NetworkInterface
    - EC2LoadBalancer
    - ELBv2
    - ELBv2TargetGroup
    - S3Bucket
    - AutoScalingGroup
    - AutoScalingLaunchConfiguration
❯ aws-nuke --version
aws-nuke version v3.22.0
❯ aws-nuke run  --config ~/.config/aws-nuke/nuke-config.yaml 
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=0x6eacd2]

goroutine 1 [running]:
main.main.func1()
        github.com/ekristen/aws-nuke/v3/main.go:28 +0x54
panic({0x5394160?, 0xa9b8bf0?})
        runtime/panic.go:914 +0x21f
github.com/ekristen/libnuke/pkg/config.(*Config).ResolveDeprecations(0xc000002000)
        github.com/ekristen/libnuke@v0.19.0/pkg/config/config.go:239 +0x92
github.com/ekristen/libnuke/pkg/config.New({{0x7ffe42805eca, 0x2c}, 0xc00064b9d0, 0xc0003ce000, 0x0, 0x0})
        github.com/ekristen/libnuke@v0.19.0/pkg/config/config.go:118 +0x30f
github.com/ekristen/aws-nuke/v3/pkg/config.New({{0x7ffe42805eca, 0x2c}, 0xc00064b9d0, 0xc0003ce000, 0x0, 0x0})
        github.com/ekristen/aws-nuke/v3/pkg/config/config.go:18 +0x49
github.com/ekristen/aws-nuke/v3/pkg/commands/nuke.execute(0xc000050440)
        github.com/ekristen/aws-nuke/v3/pkg/commands/nuke/nuke.go:73 +0x550
github.com/urfave/cli/v2.(*Command).Run(0xc00043a2c0, 0xc000050440, {0xc00006c840, 0x3, 0x3})
        github.com/urfave/cli/v2@v2.27.4/command.go:276 +0x9dd
github.com/urfave/cli/v2.(*Command).Run(0xc00043a9a0, 0xc000050300, {0xc000050080, 0x4, 0x4})
        github.com/urfave/cli/v2@v2.27.4/command.go:269 +0xc2e
github.com/urfave/cli/v2.(*App).RunContext(0xc0004ec000, {0x6dd9e90?, 0xa9fb0c0}, {0xc000050080, 0x4, 0x4})
        github.com/urfave/cli/v2@v2.27.4/app.go:333 +0x5db
github.com/urfave/cli/v2.(*App).Run(...)
        github.com/urfave/cli/v2@v2.27.4/app.go:307
main.main()
        github.com/ekristen/aws-nuke/v3/main.go:50 +0x1f2
ekristen commented 2 months ago

@eaudetcobello thanks for the report, I didn't think you could have a valid config without a {} after the account ID.

ekristen commented 2 months ago

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

The release is available on GitHub release

Your semantic-release bot :package::rocket: