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

SIGSEGV When importing #329

Open
pxslip opened this issue Oct 26, 2022 · 1 comment
Open

SIGSEGV When importing #329

pxslip opened this issue Oct 26, 2022 · 1 comment
Labels
Type: Bug Something isn't working

Comments

@pxslip
Copy link

pxslip commented Oct 26, 2022

General information:

Describe the bug:

Using the command terracognita aws --aws-profile profile --aws-default-region us-east-1 with either --hcl file.hcl or --module module throws the error below. Reproducible using --include aws_eip

Log message

ts=2022-10-26T19:14:56.663436785Z caller=provider.go:44 func=reader.New msg="configuring aws Reader"
ts=2022-10-26T19:14:56.944233771Z caller=provider.go:57 func=aws.NewProvider msg="configuring TF Client"
ts=2022-10-26T19:14:57.240913647Z caller=root.go:310 func=cmd.aws.RunE msg="initializing HCL writer"
ts=2022-10-26T19:14:57.240995884Z caller=root.go:315 func=cmd.aws.RunE msg="initializing TFState writer"
ts=2022-10-26T19:14:57.2410168Z caller=root.go:319 func=cmd.aws.RunE msg=importing
ts=2022-10-26T19:14:57.241030269Z caller=root.go:322 func=cmd.aws.RunE msg="starting terracognita" version=v0.8.1
ts=2022-10-26T19:14:57.241046594Z caller=import.go:66 func=provider.Import filters="\n\tTags:    [],\n\tInclude: [aws_eip],\n\tExclude: [],\n\tTargets: [],\n"
ts=2022-10-26T19:14:57.241075545Z caller=import.go:82 func=provider.Import resource=aws_eip msg="fetching the list of resources"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x66cd31c]

goroutine 1 [running]:
github.com/cycloidio/terracognita/aws.eips({0x1285fb98, 0xc00013a000}, 0xc0008ea740, {0xc00081e1e8, 0x7}, 0xc0005aed00)
        /tmp/build/6b18b934/code/aws/resources.go:1517 +0x15c
github.com/cycloidio/terracognita/aws.(*aws).Resources(0xc001d478c0, {0x1285fb98, 0xc00013a000}, {0xc00081e1e8, 0x7}, 0x1)
        /tmp/build/6b18b934/code/aws/provider.go:96 +0xba
github.com/cycloidio/terracognita/provider.Import({0x1285fb98, 0xc00013a000}, {0x12a8ffc8, 0xc0008ea740}, {0x128611e8, 0xc00047e1e0}, {0x12861220, 0xc001d47770}, 0xc0015fbdc0, {0x126dfd80, ...})
        /tmp/build/6b18b934/code/provider/import.go:91 +0xae3
github.com/cycloidio/terracognita/cmd.importProvider({0x1285fb98, 0xc00013a000}, {0x126d1b60, 0xc0004955f0}, {0x12a8ffc8, 0xc0008ea740})
        /tmp/build/6b18b934/code/cmd/root.go:323 +0x530
github.com/cycloidio/terracognita/cmd.glob..func2(0x1d68d580, {0xc0004a5d90, 0xb, 0xb})
        /tmp/build/6b18b934/code/cmd/aws.go:78 +0x2d9
github.com/spf13/cobra.(*Command).execute(0x1d68d580, {0xc0004a5ce0, 0xb, 0xb})
        /tmp/build/6b18b934/go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0x1d68d300)
        /tmp/build/6b18b934/go/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x3ad
github.com/spf13/cobra.(*Command).Execute(...)
        /tmp/build/6b18b934/go/pkg/mod/github.com/spf13/[email protected]/command.go:897
main.main()
        /tmp/build/6b18b934/code/main.go:11 +0x25

Additional context

Glancing through the list of elastic IP resources I don't see any glaring oddness that would cause this from the AWS end

@pxslip pxslip added the Type: Bug Something isn't working label Oct 26, 2022
@talset
Copy link
Member

talset commented Nov 1, 2022

I'm trying to reproduce it, I tried on several aws accounts with different region/config but I can't reproduce it with

terracognita version
The current version is: v0.8.1-3-g0756fcf

Did you try to import from a different region ?

The logs speak about invalid memory address or nil pointer dereference which can be found here: https://github.com/cycloidio/terracognita/blob/master/aws/resources.go#L1517

EIPs should have AllocationId. Just to be sure, cloud you check if you have any null AllocationId with:

aws  --region us-east-1 ec2 describe-addresses | jq .Addresses[].AllocationId

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants