SumoLogic/terraform-provider-sumologic

Cannot Create Dashboard Resource

Closed this issue · 5 comments

Multiple attempts to create a sumologic_dashboard resource has resulted in the provider completely crashing and advising to notify the maintainer there is something wrong.

Here is a dump of the error:

╷
│ Error: Request cancelled
│ 
│   with sumologic_dashboard.dashboard,
│   on dashboards.tf line 1, in resource "sumologic_dashboard" "dashboard":
│    1: resource "sumologic_dashboard" "dashboard" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-sumologic_v2.28.0 plugin:

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

goroutine 34 [running]:
github.com/SumoLogic/terraform-provider-sumologic/sumologic.GetTimeRange(0x1114d70)
	github.com/SumoLogic/terraform-provider-sumologic/sumologic/util.go:258 +0x2e5
github.com/SumoLogic/terraform-provider-sumologic/sumologic.resourceToDashboard(0xc000339730)
	github.com/SumoLogic/terraform-provider-sumologic/sumologic/resource_sumologic_dashboard.go:534 +0xb8
github.com/SumoLogic/terraform-provider-sumologic/sumologic.resourceSumologicDashboardCreate(0xc000339730, {0xf2fb40, 0xc00007c7e0})
	github.com/SumoLogic/terraform-provider-sumologic/sumologic/resource_sumologic_dashboard.go:1228 +0x10f
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc0002c7400, 0xc00074a3c0, 0xc0007152a0, {0xf2fb40, 0xc00007c7e0})
	github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/resource.go:320 +0x438
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc00016a580, 0xc000af1a68, 0xf3e73a, 0xf)
	github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/provider.go:294 +0x70
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00012ef60, {0xc000304700, 0x48f946}, 0xc000304700)
	github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/helper/plugin/grpc_provider.go:895 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xf01480, 0xc00012ef60}, {0x113e2d0, 0xc00086c8a0}, 0xc0009743c0, 0x0)
	github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/tfplugin5/tfplugin5.pb.go:3305 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0005a5880, {0x114e6e8, 0xc000556000}, 0xc00086aa20, 0xc0000c6120, 0x17b62c0, 0x0)
	google.golang.org/grpc@v1.39.0/server.go:1292 +0xc6f
google.golang.org/grpc.(*Server).handleStream(0xc0005a5880, {0x114e6e8, 0xc000556000}, 0xc00086aa20, 0x0)
	google.golang.org/grpc@v1.39.0/server.go:1617 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/grpc@v1.39.0/server.go:940 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/grpc@v1.39.0/server.go:938 +0x294

Error: The terraform-provider-sumologic_v2.28.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 issue.

Error: Terraform exited with code 1.
Error: Process completed with exit code 1.

Internal tracking jira DASH-1531

@dillonj28 could you let us know your input? Specifically the time range.

The error message suggests the error parsing the time range. You can refer how time range object be constructed https://github.com/SumoLogic/terraform-provider-sumologic/blob/master/sumologic/resource_sumologic_dashboard_test.go#L53-L55 and https://github.com/SumoLogic/terraform-provider-sumologic/blob/master/sumologic/resource_sumologic_dashboard_test.go#L370-L383

@sumo-zzhou
Here is my time_range block:

time_range {
    begin_bounded_time_range {
      from {
        relative_time_range {
          relative_time = "-1w"
        }
      }
      to {}
    }
  }

@dillonj28 can you try omitting to {}

That fixed the problem. Thanks @oshoghi