Skip to content

[BUG]: Plugin crashed on using opensearch_dashboard_object  #215

@Souvikpanda6

Description

@Souvikpanda6

What is the bug?

│ Error: Plugin did not respond

│ with opensearch_dashboard_object.test_pattern,
│ on main.tf line 9, in resource "opensearch_dashboard_object" "test_pattern":
│ 9: resource "opensearch_dashboard_object" "test_pattern" {

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


│ Error: Plugin did not respond

│ with opensearch_dashboard_object.search_test,
│ on main.tf line 30, in resource "opensearch_dashboard_object" "search_test":
│ 30: resource "opensearch_dashboard_object" "search_test" {

│ 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-opensearch_v2.3.1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1035bcac4]

goroutine 36 [running]:
github.com/opensearch-project/terraform-provider-opensearch/provider.elastic7CreateIndexIfNotExists(0x14000584c40, {0x1400049e815, 0x7})
github.com/opensearch-project/terraform-provider-opensearch/provider/resource_opensearch_dashboard_object.go:228 +0x1e4
github.com/opensearch-project/terraform-provider-opensearch/provider.resourceOpensearchDashboardObjectCreate(0x140006bcc80, {0x103b96f60, 0x14000528b00})
github.com/opensearch-project/terraform-provider-opensearch/provider/resource_opensearch_dashboard_object.go:114 +0xa0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x103d90a38?, {0x103d90a38?, 0x14000900de0?}, 0xd?, {0x103b96f60?, 0x14000528b00?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:766 +0x130
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140005348c0, {0x103d90a38, 0x14000900de0}, 0x1400050f1e0, 0x140006bcb00, {0x103b96f60, 0x14000528b00})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0x884
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x140002123d8, {0x103d90a38?, 0x14000900cc0?}, 0x140007b6190)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1078 +0xaa4
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x1400055e640, {0x103d90a38?, 0x14000900270?}, 0x1400049c0e0)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:846 +0x2b4
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x103d397c0, 0x1400055e640}, {0x103d90a38, 0x14000900270}, 0x140006bc600, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000196c00, {0x103d90a38, 0x14000900150}, {0x103d958e0, 0x140003da000}, 0x140006c6000, 0x140004adb60, 0x104541d98, 0x0)
google.golang.org/[email protected]/server.go:1369 +0xb58
google.golang.org/grpc.(*Server).handleStream(0x14000196c00, {0x103d958e0, 0x140003da000}, 0x140006c6000)
google.golang.org/[email protected]/server.go:1780 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1019 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 24
google.golang.org/[email protected]/server.go:1030 +0x13c

Error: The terraform-provider-opensearch_v2.3.1 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.

How can one reproduce the bug?

while running terraform apply on this -
provider "opensearch" {
url = "https://"
aws_profile = "prod"
aws_region = "us-east-1"
opensearch_version = "2.13"
healthcheck = false
}

resource "opensearch_dashboard_object" "test_pattern" {
body = jsonencode([
{
"_id": "index-pattern:e5539010-06dd-11eb-ab88-37d3f64f7e92",
"_source": {
"index-pattern": {
"title": "logs-us-1-*",
"timeFieldName": "@timestamp",
"fields": "[{"count":13,"name":"@timestamp","type":"date","esTypes":["date"],"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true},{"count":4,"name":"@Version","type":"string","esTypes":["keyword"],"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true},{"count":4,"name":"_id","type":"string","esTypes":["_id"],"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":false},["_type"],"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":false},{"count":0,"name":"agent.ephemeral_id","type":"string","esTypes":["text"],"scripted":false,"searchable":true,"aggregatable":false,"readFromDocValues":false},{"count":0,"name":"agent.ephemeral_id.keyword","type":"string","esTypes":["keyword"],"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true,"subType":{"multi":{"parent":"agent.ephemeral_id"}}},{"count":0,"name":"agent.hostname","type":"string","esTypes":["text"],"scripted":false,"searchable":true,"aggregatable":false,"readFromDocValues":false},["keyword"],"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true,"subType":{"multi":{"parent":"application_instance"}}},{"count":3,"name":"application_instance_id","type":"string","esTypes":["keyword"],"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true,"subType":{"multi":{"parent":"version_conflicts"}}}]",
"fieldFormatMap": "{"context_account_id":{"id":"url","params":{"parsedUrl":{"origin":"https://tools.us-1.coreinfra.io","pathname":"/_plugin/kibana/app/management","basePath":"/_plugin/kibana"},"urlTemplate":"https://us.coresystems.net/admin/accounts/{{value}}","labelTemplate":"{{value}}"}},"request_trace_id":{"id":"url","params":{"parsedUrl":{"origin":"https://tools.us-1.coreinfra.io","pathname":"/_plugin/kibana/app/kibana","basePath":"/_plugin/kibana"},"urlTemplate":"https://tools.us-1.production.fsm.int.sap/jaeger/trace/{{value}}","labelTemplate":"{{value}}"}}}"
},
"type": "index-pattern",
"references": [],
"migrationVersion": {
"index-pattern": "7.6.0"
}
}
}
])
}

resource "opensearch_dashboard_object" "search_test" {
body = jsonencode(
[
{
"_id": "search:f7a7b500-f5ab-11ee-a047-af7b2ba9c6be",
"_type":"_doc"
"_source": {
"search": {
"title": "[usage] cloud-sms-service",
"description": "",
"hits": 0,
"columns": [
"_source"
],
"sort": [],
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"highlightAll":true,"version":true,"query":{"language":"kuery","query":""},"filter":[{"meta":{"alias":null,"negate":false,"disabled":false,"type":"phrase","key":"logger_message","params":{"query":"Successfully sent message*"}},"query":{"match_phrase":{"logger_message":"Successfully sent message*"}},"$state":{"store":"appState"}},{"meta":{"alias":null,"negate":false,"disabled":false,"type":"phrase","key":"application_name","params":{"query":"cloud-sms-service"}},"query":{"match_phrase":{"application_name":"cloud-sms-service"}},"$state":{"store":"appState"}}],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}"
}
},
"type": "search",
"references": [
{
"name": "kibanaSavedObjectMeta.searchSourceJSON.index",
"type": "index-pattern",
"id": "e5539010-06dd-11eb-ab88-37d3f64f7e92"
},
{
"name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index",
"type": "index-pattern",
"id": "e5539010-06dd-11eb-ab88-37d3f64f7e92"
},
{
"name": "kibanaSavedObjectMeta.searchSourceJSON.filter[1].meta.index",
"type": "index-pattern",
"id": "e5539010-06dd-11eb-ab88-37d3f64f7e92"
}
],
"migrationVersion": {
"search": "7.9.3"
}
}
}
]
)
}

What is the expected behavior?

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

What is your host/environment?

2.3.0 and 2.3.1

Do you have any screenshots?

If applicable, add screenshots to help explain your problem.

Do you have any additional context?

Add any other context about the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions