splunk / terraform-provider-splunk

Terraform Provider for Splunk
Mozilla Public License 2.0
103 stars 75 forks source link

The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call #125

Open ngliyen opened 2 years ago

ngliyen commented 2 years ago

Hi,

When using terraform provider splunk v1.4.13 for resource splunk_data_ui_views, I ran into the below error during terraform apply stage. I am using Splunk Cloud, and authenticating with username/password. Appreciate help in reviewing this issue. Thanks!

RESOURCE SETUP

resource "splunk_data_ui_views" "dashboard" {
  name = "Terraform"
  eai_data = <<EOF
  <dashboard>
    <label>
      Terraform Test Dashboard
    </label>
  </dashboard>
  EOF
}

ERROR LOG

Error: Plugin did not respond
│ 
│   with module.splunk_dashboard.splunk_data_ui_views.dashboard,
│   on modules/splunk-dashboard/main.tf line 1, in resource "splunk_data_ui_views" "dashboard":
│    1: resource "splunk_data_ui_views" "dashboard" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-splunk_v1.4.13 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 44 [running]:
github.com/splunk/terraform-provider-splunk/splunk.getDashboardByName({0xc00038d150, 0x9}, 0xc0000d25a0)
        github.com/splunk/terraform-provider-splunk/splunk/resource_splunk_data_ui_views.go:167 +0x20c
github.com/splunk/terraform-provider-splunk/splunk.splunkDashboardsRead(0xc0003993b0, {0x17c49a0, 0xc000194f20})
        github.com/splunk/terraform-provider-splunk/splunk/resource_splunk_data_ui_views.go:73 +0x1ce
github.com/splunk/terraform-provider-splunk/splunk.splunkDashboardsCreate(0x181f980, {0x17c49a0, 0xc000194f20})
        github.com/splunk/terraform-provider-splunk/splunk/resource_splunk_data_ui_views.go:58 +0x1e8
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc00054e990, 0xc00008dbd0, 0xc000579440, {0x17c49a0, 0xc000194f20})
        github.com/hashicorp/terraform-plugin-sdk@v1.15.0/helper/schema/resource.go:310 +0x438
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc00023c900, 0xc000261a48, 0x190ff4a, 0xf)
        github.com/hashicorp/terraform-plugin-sdk@v1.15.0/helper/schema/provider.go:294 +0x70
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc000194d00, {0xc000398b60, 0x10af206}, 0xc000398b60)
        github.com/hashicorp/terraform-plugin-sdk@v1.15.0/internal/helper/plugin/grpc_provider.go:885 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x18de6c0, 0xc000194d00}, {0x1a85030, 0xc0002ac480}, 0xc000171e60, 0x0)
        github.com/hashicorp/terraform-plugin-sdk@v1.15.0/internal/tfplugin5/tfplugin5.pb.go:3305 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000420900, {0x1a92000, 0xc000420000}, 0xc00068a400, 0xc00057b4a0, 0x1fc4900, 0x0)
        google.golang.org/grpc@v1.27.1/server.go:1024 +0xd1e
google.golang.org/grpc.(*Server).handleStream(0xc000420900, {0x1a92000, 0xc000420000}, 0xc00068a400, 0x0)
        google.golang.org/grpc@v1.27.1/server.go:1313 +0xa56
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.27.1/server.go:722 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.27.1/server.go:720 +0xef

Error: The terraform-provider-splunk_v1.4.13 plugin crashed!