PaloAltoNetworks / terraform-provider-prismacloud

Terraform PrismaCloud provider
https://www.terraform.io/docs/providers/prismacloud/
Mozilla Public License 2.0
54 stars 65 forks source link

Unable to import prismacloud_report #199

Closed CanadaLifeKyle closed 1 year ago

CanadaLifeKyle commented 1 year ago

When attempting to import a prismacloud_report resource into my state, I receive the following error:

╷
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-prismacloud_v1.3.1 plugin:

panic: interface conversion: interface {} is nil, not []interface {}

goroutine 40 [running]:
github.com/terraform-providers/terraform-provider-prismacloud/prismacloud.saveReport(_, {{0xc0007966c0, 0x24}, {0xc0007966f0, 0x23}, {0xc000036870, 0x11}, {0xc000610f30, 0x5}, {0xc0007968a0, ...}, ...})
        github.com/terraform-providers/terraform-provider-prismacloud/prismacloud/resource_report.go:306 +0xde5
github.com/terraform-providers/terraform-provider-prismacloud/prismacloud.readReport({0xcba638, 0xc00026cb40}, 0xc0000b4580, {0xb58800, 0xc0005ce680})
        github.com/terraform-providers/terraform-provider-prismacloud/prismacloud/resource_report.go:383 +0x2e5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc000420240, {0xcba638, 0xc00026cb40}, 0x24, {0xb58800, 0xc0005ce680})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.3/helper/schema/resource.go:297 +0x1a3
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000420240, {0xcba638, 0xc00026cb40}, 0xc000374540, {0xb58800, 0xc0005ce680})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.3/helper/schema/resource.go:564 +0x35b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0002fc4e0, {0xcba638, 0xc00026cb40}, 0xc00026cb80)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.3/helper/schema/grpc_provider.go:575 +0x4bd
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc000299780, {0xcba6e0, 0xc000798b10}, 0xc000270780)
        github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:298 +0x1fb
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xb89540, 0xc000299780}, {0xcba6e0, 0xc000798b10}, 0xc000374380, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00030e540, {0xcc71f8, 0xc000001860}, 0xc0004ce000, 0xc000453410, 0x114a370, 0x0)
        google.golang.org/grpc@v1.48.0/server.go:1295 +0xb03
google.golang.org/grpc.(*Server).handleStream(0xc00030e540, {0xcc71f8, 0xc000001860}, 0xc0004ce000, 0x0)
        google.golang.org/grpc@v1.48.0/server.go:1636 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.48.0/server.go:932 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.48.0/server.go:930 +0x294

Error: The terraform-provider-prismacloud_v1.3.1 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Related terraform:

resource "prismacloud_report" "Example" {
    name = "Testing"
}

Commandline: terraform import prismacloud_report.Example <uuid>

I am able to import other resources without error, such as prismacloud_policy.

Terraform 1.4.0 prismacloud module 1.3.1

AnushreeHS commented 1 year ago

@CanadaLifeKyle Thanks for opening the issue, this is released with terraform version = "1.3.8" Closing the issue Thanks