GoogleCloudPlatform / terraformer

CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Apache License 2.0
12.09k stars 1.6k forks source link

terraformer import panic: interface conversion: interface {} is nil, not []interface {} when importing cloudfront resource #1869

Open rickythain opened 2 months ago

rickythain commented 2 months ago

I notice this error was raised previously and seems it has been fixed for ec2_instance resource only.

2024/04/23 00:03:55 WARN: Fail read resource from provider, wait 300ms before retry
2024/04/23 00:03:55 Fail read resource from provider, trying import command
panic: interface conversion: interface {} is nil, not []interface {}

goroutine 1 [running]:
github.com/GoogleCloudPlatform/terraformer/providers/aws.(*CloudFrontGenerator).PostConvertHook(0x14001822000)
    github.com/GoogleCloudPlatform/terraformer/providers/aws/cloud_front.go:112 +0x668
github.com/GoogleCloudPlatform/terraformer/providers/aws.(*AwsFacade).PostConvertHook(0x140039b3228?)
    github.com/GoogleCloudPlatform/terraformer/providers/aws/aws_facade.go:75 +0x28
github.com/GoogleCloudPlatform/terraformer/terraformutils.(*ProvidersMapping).CleanupProviders(0x140039b3548)
    github.com/GoogleCloudPlatform/terraformer/terraformutils/providers_mapping.go:175 +0xa0
github.com/GoogleCloudPlatform/terraformer/cmd.Import({_, _}, {{0x140013f6000, 0x55, 0x80}, {0x14000e919d0, 0x1, 0x1}, {0x16bd871ed, 0x24}, ...}, ...)
    github.com/GoogleCloudPlatform/terraformer/cmd/import.go:110 +0x1f4
github.com/GoogleCloudPlatform/terraformer/cmd.importRegionResources({{0x14000e919e0, 0x1, 0x1}, {0x14000e919d0, 0x1, 0x1}, {0x16bd871ed, 0x24}, {0x10bd056d0, 0x9}, ...}, ...)
    github.com/GoogleCloudPlatform/terraformer/cmd/provider_cmd_aws.go:121 +0x260
github.com/GoogleCloudPlatform/terraformer/cmd.newCmdAwsImporter.func1(0x14001611d00?, {0x10bcf95ed?, 0x4?, 0x10bcf95c5?})
    github.com/GoogleCloudPlatform/terraformer/cmd/provider_cmd_aws.go:58 +0x778
github.com/spf13/cobra.(*Command).execute(0x14000d57600, {0x1400043cbd0, 0x9, 0x9})
    github.com/spf13/cobra@v1.1.1/command.go:850 +0x554
github.com/spf13/cobra.(*Command).ExecuteC(0x14000d56580)
    github.com/spf13/cobra@v1.1.1/command.go:958 +0x310
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.1.1/command.go:895
github.com/GoogleCloudPlatform/terraformer/cmd.Execute()
    github.com/GoogleCloudPlatform/terraformer/cmd/root.go:36 +0x20
main.main()
    github.com/GoogleCloudPlatform/terraformer/main.go:39 +0x50
kteagueof commented 2 weeks ago

Also getting this trying to import cloudflare records.

panic: interface conversion: interface {} is []interface {}, not map[string]interface {}

goroutine 1 [running]:
github.com/GoogleCloudPlatform/terraformer/providers/cloudflare.(*DNSGenerator).PostConvertHook(0x14001d22240)
    github.com/GoogleCloudPlatform/terraformer/providers/cloudflare/dns.go:118 +0x220
github.com/GoogleCloudPlatform/terraformer/terraformutils.(*ProvidersMapping).CleanupProviders(0x14002037a08)
    github.com/GoogleCloudPlatform/terraformer/terraformutils/providers_mapping.go:175 +0xa0
github.com/GoogleCloudPlatform/terraformer/cmd.Import({_, _}, {{0x14000379bc0, 0x1, 0x1}, {0x1142f7300, 0x0, 0x0}, {0x10a8963e0, 0x1e}, ...}, ...)
    github.com/GoogleCloudPlatform/terraformer/cmd/import.go:110 +0x1f4
github.com/GoogleCloudPlatform/terraformer/cmd.newCmdCloudflareImporter.func1(0x14001225a00?, {0x10a7e95ed?, 0x4?, 0x10a7e95c5?})
    github.com/GoogleCloudPlatform/terraformer/cmd/provider_cmd_cloudflare.go:30 +0x80
github.com/spf13/cobra.(*Command).execute(0x14000d21340, {0x14000379800, 0x1, 0x1})
    github.com/spf13/cobra@v1.1.1/command.go:850 +0x554
github.com/spf13/cobra.(*Command).ExecuteC(0x14000636580)
    github.com/spf13/cobra@v1.1.1/command.go:958 +0x310
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.1.1/command.go:895
github.com/GoogleCloudPlatform/terraformer/cmd.Execute()
    github.com/GoogleCloudPlatform/terraformer/cmd/root.go:36 +0x20
main.main()
    github.com/GoogleCloudPlatform/terraformer/main.go:39 +0x50