Skip to content

Conversation

nick-benoit
Copy link
Contributor

@nick-benoit nick-benoit commented Oct 10, 2025

Fixes nil pointer error due to optional filter (docs) not being set in indicator properties SLOs_indicator_properties_custom_kql

example:

		                kql_custom_indicator {
		                	index = "my-index-%s"
		                	good = "latency < 300"
		                	total = "*"
		                	timestamp_field = "custom_timestamp"
		                }
				

Note that this only seems to be a problem for kql_custom_indicator because it is the only case where Filter is a struct (*KqlWithFilters) instead of a *string

Previously the provider would fail with the following error:

Error: Plugin did not respond

The plugin encountered an error, and failed to respond to the
plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
details.

Error: Request cancelled

The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled.

Stack trace from the terraform-provider-elasticstack_v0.11.18 plugin:

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

goroutine 490 [running]:
github.com/elastic/terraform-provider-elasticstack/internal/kibana.resourceSloRead({0x1b1ad10, 0x400083e700}, 0x400088eab0, {0x1781c00?, 0x40004b46c0?})
        github.com/elastic/terraform-provider-elasticstack/internal/kibana/slo.go:1022 +0xad4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x40003dad00, {0x1b1ac68, 0x4000fd7ce0}, 0x400088eab0, {0x1781c00, 0x40004b46c0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:866 +0xe0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x40003dad00, {0x1b1ac68, 0x4000fd7ce0}, 0x4000903ad0, {0x1781c00, 0x40004b46c0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1162 +0x3d4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x400000cdb0, {0x1b1ac68?, 0x4000fd7bc0?}, 0x4000835180)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:915 +0x92c
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ReadResource({{0x1b370b8?, 0x400000cdb0?}}, {0x1b1ac68, 0x4000fd7bc0}, 0x0?)
        github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:188 +0x58
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0x400028cf30, {0x1b1ac68?, 0x4000fd78f0?}, 0x4000835130)
        github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ReadResource.go:35 +0x178
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0x4000185180, {0x1b1ac68?, 0x4000fd70e0?}, 0x40002a8700)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:863 +0x1f8
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x17d7dc0, 0x4000185180}, {0x1b1ac68, 0x4000fd70e0}, 0x4000e23680, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:753 +0x1b8
google.golang.org/grpc.(*Server).processUnaryRPC(0x40002a4000, {0x1b1ac68, 0x4000fd7050}, 0x4000ebe780, 0x400023dcb0, 0x2b9c2f8, 0x0)
        google.golang.org/[email protected]/server.go:1431 +0xbd0
google.golang.org/grpc.(*Server).handleStream(0x40002a4000, {0x1b1bdf8, 0x400019e820}, 0x4000ebe780)
        google.golang.org/[email protected]/server.go:1842 +0x858
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1061 +0x74
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 44
        google.golang.org/[email protected]/server.go:1072 +0x120

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

Rel: #1098

@nick-benoit nick-benoit requested review from gigerdo and tobio October 10, 2025 23:21
@nick-benoit nick-benoit marked this pull request as ready for review October 10, 2025 23:21
tobio
tobio previously approved these changes Oct 12, 2025
Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you add a changelog entry for this too?

gigerdo
gigerdo previously approved these changes Oct 13, 2025
@nick-benoit nick-benoit dismissed stale reviews from gigerdo and tobio via 19a0899 October 13, 2025 15:01
@nick-benoit nick-benoit merged commit 0a82d10 into main Oct 13, 2025
54 checks passed
@nick-benoit nick-benoit deleted the fix-slo-without-filter branch October 13, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants