Skip to content

[Bug] Kibana SLO custom_histogram_indicator panics when using to and from #429

Closed
@marclop

Description

@marclop

Describe the bug

module.SLO.elasticstack_kibana_slo.e2e_latency: Creating...
╷
│ Error: Plugin did not respond
│
│   with module.SLO.elasticstack_kibana_slo.e2e_latency,
│   on ../../slo/main.tf line 10, in resource "elasticstack_kibana_slo" "e2e_latency":
│   10: resource "elasticstack_kibana_slo" "e2e_latency" {
│
│ 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-elasticstack_v0.7.0 plugin:

panic: interface conversion: interface {} is int, not float64

goroutine 38 [running]:
github.com/elastic/terraform-provider-elasticstack/internal/kibana.getOrNilFloat({0x14000782c30?, 0x1052d5305?}, 0x0?)
	github.com/elastic/terraform-provider-elasticstack/internal/kibana/slo.go:444 +0x9c
github.com/elastic/terraform-provider-elasticstack/internal/kibana.getSloFromResourceData(0x14000000001?)
	github.com/elastic/terraform-provider-elasticstack/internal/kibana/slo.go:521 +0xc28
github.com/elastic/terraform-provider-elasticstack/internal/kibana.resourceSloCreate({0x10573ab48, 0x1400055b5c0}, 0x0?, {0x1056a0820, 0x140006262c0})
	github.com/elastic/terraform-provider-elasticstack/internal/kibana/slo.go:611 +0xa0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x1400039f260, {0x10573ab80, 0x14000300ff0}, 0xd?, {0x1056a0820, 0x140006262c0})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:707 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x1400039f260, {0x10573ab80, 0x14000300ff0}, 0x140000a9110, 0x1400039ac00, {0x1056a0820, 0x140006262c0})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0x888
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400000d368, {0x10573ab80?, 0x14000300ed0?}, 0x14000302370)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xb78
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.muxServer.ApplyResourceChange({0x14000381080, 0x140004ad230, 0x140003810b0, 0x140003810e0, {0x1400036f660, 0x1, 0x1}}, {0x10573ab80?, 0x14000300ba0?}, 0x14000302370)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:30 +0x100
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140002e1360, {0x10573ab80?, 0x140003001b0?}, 0x140005260e0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:821 +0x3bc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1056ce860?, 0x140002e1360}, {0x10573ab80, 0x140003001b0}, 0x14000526070, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400025e1e0, {0x10573eba0, 0x140003a31e0}, 0x14000308000, 0x1400043ced0, 0x106059020, 0x0)
	google.golang.org/[email protected]/server.go:1337 +0xc90
google.golang.org/grpc.(*Server).handleStream(0x1400025e1e0, {0x10573eba0, 0x140003a31e0}, 0x14000308000, 0x0)
	google.golang.org/[email protected]/server.go:1714 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/[email protected]/server.go:959 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:957 +0x16c

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

To Reproduce
Steps to reproduce the behavior:

  1. TF configuration used '...'
  2. TF operations to execute to get the error '...' [e.g terraform plan,terraform apply, terraform destroy]
  3. See the error in the output '...'
resource "elasticstack_kibana_slo" "processing_slo" {
  name             = "[MIS] E2E latency SLO"
  description      = "Proportion of valid events that are processed in under 3 minutes"
  budgeting_method = "occurrences"
  timestamp_field  = "@timestamp"

  histogram_custom_indicator {
    index = "metrics-*"
    good {
      field       = "event.latency"
      aggregation = "range"
      from        = 0
      to          = 180
    }
    total {
      field       = "event.latency"
      aggregation = "value_count"
    }
    
  }

  time_window {
    duration = "30d"
    type     = "rolling"
  }

  objective {
    target = 0.99
  }
}

Expected behavior
A clear and concise description of what you expected to happen.

Debug output
Run terraform command with TF_LOG=trace and provide extended information on TF operations.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • OS: [e.g. Linux]
  • Terraform Version [e.g. 1.0.0]
  • Provider version [e.g. v0.1.0]
  • Elasticsearch Version [e.g. 7.16.0]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions