Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Since 0.11.12, elasticstack_kibana_data_view crashing with "panic: runtime error: invalid memory address or nil pointer dereference" #975

Open
gavD opened this issue Jan 9, 2025 · 0 comments · May be fixed by #979
Labels
bug Something isn't working
Milestone

Comments

@gavD
Copy link

gavD commented Jan 9, 2025

Describe the bug
Our Terraform works fine with 0.11.11 and prior versions.

However, if we use 0.11.12, we get errors whenever using elasticstack_kibana_data_view

We suspect it's something to do with this change #881 which reworks dataview

To Reproduce
Steps to reproduce the behavior:

  1. TF configuration used: hard to say what's relevant and what's not, but here's our TF:
resource "elasticstack_kibana_import_saved_objects" "settings" {
  overwrite     = true
  file_contents = local.advanced_settings_content
}

resource "elasticstack_kibana_data_view" "index_pattern" {
  for_each = var.index_patterns

  override = true

  data_view = {
    allow_no_index  = true
    id              = each.key
    name            = each.value.title
    time_field_name = each.value.time_field
    title           = each.value.title
  }

  depends_on = [elasticstack_kibana_import_saved_objects.settings]
}
  1. TF operations to execute to get the error: terraform apply
  2. See the error in the output
    Expected behavior
    It should not crash

Debug output

Planning failed. Terraform encountered an error while generating this plan.
243 |  
244 | ╷
245 | │ Error: Request cancelled
246 | │
247 | │ The plugin6.(*GRPCProvider).ReadResource request was cancelled.
248 | ╵
249 | ╷
250 | │ Error: Plugin did not respond
251 | │
252 | │ The plugin encountered an error, and failed to respond to the
253 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
254 | │ details.
255 | ╵
256 | ╷
257 | │ Error: Request cancelled
258 | │
259 | │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled.
260 | ╵
261 | ╷
262 | │ Error: Plugin did not respond
263 | │
264 | │ The plugin encountered an error, and failed to respond to the
265 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
266 | │ details.
267 | ╵
268 | ╷
269 | │ Error: Plugin did not respond
270 | │
271 | │ The plugin encountered an error, and failed to respond to the
272 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
273 | │ details.
274 | ╵
275 | ╷
276 | │ Error: Plugin did not respond
277 | │
278 | │ The plugin encountered an error, and failed to respond to the
279 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
280 | │ details.
281 | ╵
282 | ╷
283 | │ Error: Request cancelled
284 | │
285 | │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled.
286 | ╵
287 | ╷
288 | │ Error: Plugin did not respond
289 | │
290 | │ The plugin encountered an error, and failed to respond to the
291 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
292 | │ details.
293 | ╵
294 | ╷
295 | │ Error: Request cancelled
296 | │
297 | │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled.
298 | ╵
299 | ╷
300 | │ Error: Request cancelled
301 | │
302 | │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled.
303 | ╵
304 | ╷
305 | │ Error: Plugin did not respond
306 | │
307 | │ The plugin encountered an error, and failed to respond to the
308 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
309 | │ details.
310 | ╵
311 | ╷
312 | │ Error: Plugin did not respond
313 | │
314 | │ The plugin encountered an error, and failed to respond to the
315 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
316 | │ details.
317 | ╵
318 | ╷
319 | │ Error: Plugin did not respond
320 | │
321 | │ The plugin encountered an error, and failed to respond to the
322 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
323 | │ details.
324 | ╵
325 | ╷
326 | │ Error: Plugin did not respond
327 | │
328 | │ The plugin encountered an error, and failed to respond to the
329 | │ plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more
330 | │ details.
331 | ╵
332 | ╷
333 | │ Error: Request cancelled
334 | │
335 | │ The plugin6.(*GRPCProvider).UpgradeResourceState request was cancelled.
336 | ╵
337 |  
338 | Stack trace from the terraform-provider-elasticstack_v0.11.12 plugin:
339 |  
340 | panic: runtime error: invalid memory address or nil pointer dereference
341 | [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x147b15d]
342 |  
343 | goroutine 149 [running]:
344 | github.com/elastic/terraform-provider-elasticstack/internal/kibana/data_view.dataViewModel.getViewIDAndSpaceID({{0x2, {0xc000431950, 0x41}}, {0x2, {0xc000597dd8, 0x7}}, {0x2, 0x1}, {0xc0008d5860, 0xc0008d46f0, ...}})
345 | github.com/elastic/terraform-provider-elasticstack/internal/kibana/data_view/models.go:237 +0x1d
346 | github.com/elastic/terraform-provider-elasticstack/internal/kibana/data_view.(*DataViewResource).Read(0xc000112878, {0x1b4b7b8, 0xc0008c0450}, {{{{0x1b52298, 0xc0008d4030}, {0x16e6460, 0xc0008c9a10}}, {0x1b55390, 0xc00049c730}}, 0xc000112898, ...}, ...)
347 | github.com/elastic/terraform-provider-elasticstack/internal/kibana/data_view/read.go:25 +0x1b8
348 | github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadResource(0xc000181448, {0x1b4b7b8, 0xc0008c0450}, 0xc0008c04b0, 0xc0004c5590)
349 | github.com/hashicorp/[email protected]/internal/fwserver/server_readresource.go:117 +0x84e
350 | github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadResource(0xc000181448, {0x1b4b7b8?, 0xc0008c0360?}, 0xc0000ad240)
351 | github.com/hashicorp/[email protected]/internal/proto6server/server_readresource.go:55 +0x38e
352 | github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0xc0002b0f00, {0x1b4b7b8?, 0xc0008c0090?}, 0xc0000ad240)
353 | github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ReadResource.go:35 +0x193
354 | github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc0000d8000, {0x1b4b7b8?, 0xc0008b7860?}, 0xc0002291f0)
355 | github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:784 +0x2f3
356 | github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x18aee00, 0xc0000d8000}, {0x1b4b7b8, 0xc0008b7860}, 0xc0000cee00, 0x0)
357 | github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:575 +0x1a6
358 | google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000d4000, {0x1b4b7b8, 0xc0008b77d0}, {0x1b53940, 0xc0003691e0}, 0xc0009190e0, 0xc0000a0cc0, 0x2861928, 0x0)
359 | google.golang.org/[email protected]/server.go:1394 +0xe2b
360 | google.golang.org/grpc.(*Server).handleStream(0xc0000d4000, {0x1b53940, 0xc0003691e0}, 0xc0009190e0)
361 | google.golang.org/[email protected]/server.go:1805 +0xe8b
362 | google.golang.org/grpc.(*Server).serveStreams.func2.1()
363 | google.golang.org/[email protected]/server.go:1029 +0x7f
364 | created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 15
365 | google.golang.org/[email protected]/server.go:1040 +0x125
366 |  
367 | Error: The terraform-provider-elasticstack_v0.11.12 plugin crashed!
368 |  
369 | This is always indicative of a bug within the plugin. It would be immensely
370 | helpful if you could report the crash with the plugin's maintainers so that it
371 | can be fixed. The output above should help diagnose the issue.

Screenshots
n/a

Versions (please complete the following information):

  • OS: MacOS and build from debian-based container in AWS have the same result
  • Terraform Version 1.5.5
  • Provider version 0.11.12
  • Elasticsearch Version 8.16.0

Additional context
n/a

@gavD gavD added the bug Something isn't working label Jan 9, 2025
@Kushmaro Kushmaro added this to the 0.14.0 milestone Jan 9, 2025
@tobio tobio linked a pull request Jan 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants