nutanix / terraform-provider-nutanix

Terraform Nutanix Provider
https://www.terraform.io/docs/providers/nutanix/
Mozilla Public License 2.0
95 stars 111 forks source link

trying to fetch data from nutnanix recovery plans but it is failing #566

Open jatin9694 opened 1 year ago

jatin9694 commented 1 year ago

Plugin did not respond │ Error: Plugin did not respond │ │ with data.nutanix_recovery_plans.recovery_plans, │ on main.tf line 4, in data "nutanix_recovery_plans" "recovery_plans": │ 4: data "nutanix_recovery_plans" "recovery_plans" {} │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more details. ╵

Stack trace from the terraform-provider-nutanix_v1.7.0 plugin:

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

goroutine 113 [running]: github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenRecoveryNetwork(0x0) github.com/terraform-providers/terraform-provider-nutanix/nutanix/resource_nutanix_recovery_plan.go:1290 +0x42 github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenNetworkMappingList({0xc000816ea0, 0x1, 0x196d32b}) github.com/terraform-providers/terraform-provider-nutanix/nutanix/resource_nutanix_recovery_plan.go:1272 +0x3b6 github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenParameters(0xc0009509f0) github.com/terraform-providers/terraform-provider-nutanix/nutanix/resource_nutanix_recovery_plan.go:1221 +0xdb github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenRecoveryPlanEntities({0xc0004d8600, 0x5, 0xb}) github.com/terraform-providers/terraform-provider-nutanix/nutanix/data_source_recovery_plans.go:580 +0x37e github.com/terraform-providers/terraform-provider-nutanix/nutanix.dataSourceNutanixRecoveryPlansRead({0x1a82e38, 0xc000900240}, 0x3a41878, {0x18140a0, 0xc0007117d0}) github.com/terraform-providers/terraform-provider-nutanix/nutanix/data_source_recovery_plans.go:558 +0x206 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).read(0xc0000d36c0, {0x1a82e38, 0xc000900240}, 0xc0006ec4e0, {0x18140a0, 0xc0007117d0}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:358 +0x12e github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).ReadDataApply(0xc0000d36c0, {0x1a82e38, 0xc000900240}, 0xc00099b300, {0x18140a0, 0xc0007117d0}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:569 +0xf7 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ReadDataSource(0xc000446018, {0x1a82e38, 0xc000900240}, 0xc00007e2c0) github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/grpc_provider.go:1133 +0x3a8 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ReadDataSource(0xc000142f00, {0x1a82ee0, 0xc00043ea20}, 0xc000144b40) github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:478 +0x37b github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x192c9c0, 0xc000142f00}, {0x1a82ee0, 0xc00043ea20}, 0xc000182ba0, 0x0) github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc00015c700, {0x1a90c70, 0xc0001f6480}, 0xc0006ce000, 0xc0004c1ce0, 0x1fd6230, 0x0) google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f google.golang.org/grpc.(Server).handleStream(0xc00015c700, {0x1a90c70, 0xc0001f6480}, 0xc0006ce000, 0x0) google.golang.org/grpc@v1.32.0/server.go:1517 +0xa2a google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.32.0/server.go:859 +0x98 created by google.golang.org/grpc.(Server).serveStreams.func1 google.golang.org/grpc@v1.32.0/server.go:857 +0x294

Error: The terraform-provider-nutanix_v1.7.0 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

jatin9694 commented 1 year ago

I am using mac

% sw_vers
ProductName: macOS ProductVersion: 13.2.1 BuildVersion: 22D68

jatin9694 commented 1 year ago

@bhatipradeep @ruknaankur can you pls check why plugin is getting crashed.

bhati-pradeep commented 1 year ago

@jatin9694 Will check and get back on this cc: @abhimutant

bhati-pradeep commented 1 year ago

Meanwhile @jatin9694 Is it possible to get sample .tf code block that you are using for fetching the recovery plans. Thank you

jatin9694 commented 1 year ago

data "nutanix_recovery_plans" "recovery_plans" { }

output.tf

output "clusters" { value = [ for entity in data.nutanix_recovery_plans.recovery_plans.entities : entity.name if entity.name == "RP-Munich-SaasDev" ] }

I am trying to fetch one entity i have tried simple fetching as well with data.nutanix_recovery_plans.recovery_plans.entities.*.name but same error always.

bhati-pradeep commented 1 year ago

@jatin9694 I am not able to reproduce this issue with latest v1.8.0 and v1.7.0. Please share Terraform Logs after masking out internal details. Logs can be collected using TF_LOG=trace TF_LOG_PATH=tf.log terraform <command>.

jatin9694 commented 1 year ago

please find the error from the log file .

terraform version =

terraform -v Terraform v1.3.7 on darwin_amd64

nutanix_v1.7.1

TF_LOG=trace TF_LOG_PATH=tf.log terraform plan.

2023-03-14T09:51:39.050+0100 [INFO] provider.terraform-provider-nutanix_v1.7.1: 2023/03/14 09:51:39 [DEBUG] flattenEntityInfoList result: [map[entity_info_list:[map[categories:[map[name:RecoveryPlan value:Munich-CritIT-S1]]]]]]: timestamp=2023-03-14T09:51:39.050+0100 2023-03-14T09:51:39.050+0100 [INFO] provider.terraform-provider-nutanix_v1.7.1: 2023/03/14 09:51:39 [DEBUG] flattenEntityInfoList result: [map[entity_info_list:[map[categories:[map[name:RecoveryPlan value:Munich-CritIT-S2]]]]]]: timestamp=2023-03-14T09:51:39.050+0100 2023-03-14T09:51:39.050+0100 [INFO] provider.terraform-provider-nutanix_v1.7.1: 2023/03/14 09:51:39 [DEBUG] flattenEntityInfoList result: [map[entity_info_list:[map[categories:[map[name:RecoveryPlan value:Munich-CrtiIT-S3]]]]]]: timestamp=2023-03-14T09:51:39.050+0100 2023-03-14T09:51:39.050+0100 [TRACE] provider.terraform-provider-nutanix_v1.7.1: Served request: tf_provider_addr=provider tf_req_id=a9c2ba02-06cd-085a-d218-e3ac15ec41f7 tf_data_source_type=nutanix_recovery_plans @module=sdk.proto tf_proto_version=5 tf_rpc=ReadDataSource @caller=runtime/panic.go:1038 timestamp=2023-03-14T09:51:39.050+0100 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: panic: runtime error: invalid memory address or nil pointer dereference 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x179af42] 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: goroutine 39 [running]: 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenRecoveryNetwork(0x0) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix/resource_nutanix_recovery_plan.go:1290 +0x42 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenNetworkMappingList({0xc00031a900, 0x1, 0x19826f8}) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix/resource_nutanix_recovery_plan.go:1272 +0x3b6 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenParameters(0xc0002ef9e0) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix/resource_nutanix_recovery_plan.go:1221 +0xdb 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix.flattenRecoveryPlanEntities({0xc000383890, 0x5, 0xb}) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix/data_source_recovery_plans.go:580 +0x37e 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix.dataSourceNutanixRecoveryPlansRead({0x1a9aa58, 0xc00043a380}, 0x305e5b8, {0x1827f40, 0xc0004dd020}) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/terraform-providers/terraform-provider-nutanix/nutanix/data_source_recovery_plans.go:558 +0x206 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).read(0xc00057bb20, {0x1a9aa58, 0xc00043a380}, 0xc0004f1770, {0x1827f40, 0xc0004dd020}) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:358 +0x12e 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).ReadDataApply(0xc00057bb20, {0x1a9aa58, 0xc00043a380}, 0xc000396e00, {0x1827f40, 0xc0004dd020}) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:569 +0xf7 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ReadDataSource(0xc00043c018, {0x1a9aa58, 0xc00043a380}, 0xc00031a2e0) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/grpc_provider.go:1133 +0x3a8 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ReadDataSource(0xc00018b180, {0x1a9ab00, 0xc00010e840}, 0xc00059e2d0) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:478 +0x37b 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x19419c0, 0xc00018b180}, {0x1a9ab00, 0xc00010e840}, 0xc00039a180, 0x0) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x170 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: google.golang.org/grpc.(Server).processUnaryRPC(0xc00021f180, {0x1aa8890, 0xc0005de000}, 0xc000122100, 0xc0004675f0, 0x1ff4230, 0x0) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: google.golang.org/grpc.(Server).handleStream(0xc00021f180, {0x1aa8890, 0xc0005de000}, 0xc000122100, 0x0) 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: google.golang.org/grpc@v1.32.0/server.go:1517 +0xa2a 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: google.golang.org/grpc.(Server).serveStreams.func1.2() 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: google.golang.org/grpc@v1.32.0/server.go:859 +0x98 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: created by google.golang.org/grpc.(Server).serveStreams.func1 2023-03-14T09:51:39.053+0100 [DEBUG] provider.terraform-provider-nutanix_v1.7.1: google.golang.org/grpc@v1.32.0/server.go:857 +0x294 2023-03-14T09:51:39.056+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/nutanix/nutanix/1.7.1/darwin_amd64/terraform-provider-nutanix_v1.7.1 pid=31334 error="exit status 2" 2023-03-14T09:51:39.056+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2023-03-14T09:51:39.057+0100 [ERROR] plugin.(*GRPCProvider).ReadDataSource: error="rpc error: code = Unavailable desc = error reading from server: EOF" 2023-03-14T09:51:39.057+0100 [ERROR] vertex "data.nutanix_recovery_plans.recovery_plans" error: Plugin did not respond 2023-03-14T09:51:39.057+0100 [TRACE] vertex "data.nutanix_recovery_plans.recovery_plans": visit complete, with errors 2023-03-14T09:51:39.057+0100 [TRACE] vertex "data.nutanix_recovery_plans.recovery_plans (expand)": dynamic subgraph encountered errors: Plugin did not respond 2023-03-14T09:51:39.057+0100 [ERROR] vertex "data.nutanix_recovery_plans.recovery_plans (expand)" error: Plugin did not respond 2023-03-14T09:51:39.057+0100 [TRACE] vertex "data.nutanix_recovery_plans.recovery_plans (expand)": visit complete, with errors 2023-03-14T09:51:39.057+0100 [TRACE] dag/walk: upstream of "output.clusters (expand)" errored, so skipping 2023-03-14T09:51:39.057+0100 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/nutanix/nutanix\"] (close)" errored, so skipping 2023-03-14T09:51:39.057+0100 [TRACE] dag/walk: upstream of "root" errored, so skipping 2023-03-14T09:51:39.058+0100 [INFO] backend/local: plan operation completed 2023-03-14T09:51:39.061+0100 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info 2023-03-14T09:51:39.061+0100 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock 2023-03-14T09:51:39.062+0100 [DEBUG] provider: plugin exited jku@jku Recovery_Plan copy %

bhati-pradeep commented 1 year ago

Is there any /api/nutanix/v3/recovery_plans/list API call REQUEST and RESPONSE in terraform logs ?

Also can you please try api call from outside terraform https://<pcip>:9440/api/nutanix/v3/recovery_plans/list with payload just to strike out setup issue:

{
 "filter": "",
 "kind": "recovery_plan",
 "length": 100
}
LK1120 commented 1 week ago

Same issue. API call works fine when calling Prism Central for list of all recovery plans via curl etc. But not via Terraform plugin. Screenshots attached. Terraform and Nutanix plugin version is 1.9.5.

IMG_0406 IMG_0405 IMG_0404