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]: opensearch dashboard creation gives 400 error code on custom url #210

Closed
Souvikpanda6 opened this issue Sep 13, 2024 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Souvikpanda6
Copy link

What is the bug?

i am trying to create opensearch dashboards. i used this to create and it got created when i used localhost by login to cluster and port-forwarding. but this doesn't work for the custom url - https://cutsom/_dashboards.
object for creation of dashboard -
resource "opensearch_dashboard_object" "combined_dashboards" {

body = jsonencode([
{
"id": "dashboard:Test Outage dashboard",
"_type": "_doc",
"_source": {
"type": "dashboard",
"dashboard": {
"title": "Test Outage Dashboard",
"hits": 0,
"description": "",
"panelsJSON": "[{"version":"1.3.2","gridData":{"x":0,"y":0,"w":9,"h":32,"i":"af43a9f2-f1df-49dd-8cd4-8b7da376f352"},"panelIndex":"af43a9f2-f1df-49dd-8cd4-8b7da376f352","embeddableConfig":{"title":"[impact] SMS Service","hidePanelTitles":false},"title":"[impact] SMS Service","panelRefName":"panel_0"},{"version":"1.3.2","gridData":{"x":9,"y":0,"w":7,"h":32,"i":"452f2f5e-c34a-4768-8934-32f58fdd211f"},"panelIndex":"452f2f5e-c34a-4768-8934-32f58fdd211f","embeddableConfig":{"title":"[impact] MDI Connector","hidePanelTitles":false},"title":"[impact] MDI Connector","panelRefName":"panel_1"},{"version":"1.3.2","gridData":{"x":16,"y":0,"w":8,"h":32,"i":"b2d0e573-eabb-4a31-896b-8be53523f69b"},"panelIndex":"b2d0e573-eabb-4a31-896b-8be53523f69b","embeddableConfig":{"title":"[impact] Streaming API","hidePanelTitles":false},"title":"[impact] Streaming API","panelRefName":"panel_2"},{"version":"1.3.2","gridData":{"x":24,"y":0,"w":7,"h":32,"i":"fb66628f-2d57-4b40-b663-f0a5e21d67f7"},"panelIndex":"fb66628f-2d57-4b40-b663-f0a5e21d67f7","embeddableConfig":{},"panelRefName":"panel_3"},{"version":"1.3.2","gridData":{"x":31,"y":0,"w":8,"h":32,"i":"7b3d2ab0-8d86-48ba-9f70-f7e9445ffdd6"},"panelIndex":"7b3d2ab0-8d86-48ba-9f70-f7e9445ffdd6","embeddableConfig":{},"panelRefName":"panel_4"},{"version":"1.3.2","gridData":{"x":39,"y":0,"w":8,"h":32,"i":"8b268192-c9bd-469c-9fc8-70b7d44cb941"},"panelIndex":"8b268192-c9bd-469c-9fc8-70b7d44cb941","embeddableConfig":{},"panelRefName":"panel_5"},{"version":"1.3.2","gridData":{"x":0,"y":32,"w":9,"h":22,"i":"36d2b578-7f12-4de5-9fb0-7f786f9d4ba1"},"panelIndex":"36d2b578-7f12-4de5-9fb0-7f786f9d4ba1","embeddableConfig":{},"panelRefName":"panel_6"}]",
"optionsJSON": "{"hidePanelTitles":false,"useMargins":true}",
"version": 1,
"timeRestore": true,
"timeTo": "now",
"timeFrom": "now-4w",
"refreshInterval": {
"pause": true,
"value": 0
},
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"query":{"language":"kuery","query":""},"filter":[]}"
}
},
"references": [
{
"name": "panel_0",
"type": "visualization",
"id": "4a1feb90-f5ac-11ee-9eaf-7b883d41eea5"
},
{
"name": "panel_1",
"type": "visualization",
"id": "7bfcc970-f643-11ee-9e29-8b89be297bc7"
},
{
"name": "panel_2",
"type": "visualization",
"id": "82569500-f646-11ee-a047-af7b2ba9c6be"
},
{
"name": "panel_3",
"type": "visualization",
"id": "fbc8b610-f647-11ee-9eaf-7b883d41eea5"
},
{
"name": "panel_4",
"type": "visualization",
"id": "7a612130-f64b-11ee-9e29-8b89be297bc7"
},
{
"name": "panel_5",
"type": "visualization",
"id": "b5a57150-f64c-11ee-a047-af7b2ba9c6be"
},
{
"name": "panel_6",
"type": "visualization",
"id": "df704550-f72d-11ee-a047-af7b2ba9c6be"
}
],
"migrationVersion": {
"dashboard": "7.9.3"
}
}
}
])
}

using this code for visualizations -

resource "opensearch_dashboard_object" "combined_visualizations" {
body = jsonencode([
{
"id": "visualization:4a1feb90-f5ac-11ee-9eaf-7b883d41eea5",
"_type": "doc",
"_source": {
"type": "visualization",
"visualization": {
"title": "[impact] SMS Senders",
"visState": "{"title":"[impact] SMS Senders","type":"table","aggs":[{"id":"1","enabled":true,"type":"count","params":{"customLabel":"Sent SMS messages"},"schema":"metric"},{"id":"2","enabled":true,"type":"terms","params":{"field":"context_account_id.keyword","orderBy":"1","order":"desc","size":10000,"otherBucket":false,"otherBucketLabel":"Other","missingBucket":false,"missingBucketLabel":"Missing","customLabel":"Account"},"schema":"bucket"}],"params":{"perPage":25,"showPartialRows":false,"showMetricsAtAllLevels":false,"sort":{"columnIndex":null,"direction":null},"showTotal":false,"totalFunc":"sum","percentageCol":""}}",
"uiStateJSON": "{"vis":{"params":{"sort":{"columnIndex":null,"direction":null}}}}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"query":{"query":"","language":"kuery"},"filter":[]}"
},
"savedSearchRefName": "search_0"
},
"references": [
{
"name": "search_0",
"type": "search",
"id": "f7a7b500-f5ab-11ee-a047-af7b2ba9c6be"
}
],
"migrationVersion": {
"visualization": "7.10.0"
}
}
}])
}

this code works and creates dashboard and visualizations using localhost:port.
i want to automate the depolyment of dashboards so want this to work for the customurl
url i was while getting 400 - https://custom-end/_dashboards

on doing terraform plan this things does the plan. BUt this error is got when trying to apply

How can one reproduce the bug?

Steps to reproduce the behavior.
on terraform apply -
error -
Error: Failed to create new Dashboard index: elastic: Error 400 (Bad Request)

│ with opensearch_dashboard_object.combined_visualizations["visualization:b5a57150-f64c-11ee-a047-af7b2ba9c6be"],
│ on main.tf line 1, in resource "opensearch_dashboard_object" "combined_visualizations":
│ 1: resource "opensearch_dashboard_object" "combined_visualizations" {



│ Error: Failed to create new Dashboard index: elastic: Error 400 (Bad Request)

│ with opensearch_dashboard_object.combined_dashboards["dashboard:Test Outage dashboard"],
│ on main.tf line 27, in resource "opensearch_dashboard_object" "combined_dashboards":
│ 27: resource "opensearch_dashboard_object" "combined_dashboards" {

What is the expected behavior?

i expected to create the dashboard and visualization in the UI.

What is your host/environment?

Operating system, version.

Do you have any screenshots?

Do you have any additional context?

Add any other context about the problem.

@Souvikpanda6
Copy link
Author

Souvikpanda6 commented Sep 13, 2024

provider config -
provider "opensearch" {
aws_region = "region"
aws_profile = "dev"
url = "https://custom_endpoint/_dashboards"
opensearch_version = "2.3.0"
healthcheck = false
}

terraform {
required_providers {
opensearch = {
source = "opensearch-project/opensearch"
version = "2.3.0"
}
}
}

@Souvikpanda6
Copy link
Author

This works for me now i was due to an proxy in between. Thanks
Still i have one more issue which is - #205 (comment)
can someone help me with this ??

@prudhvigodithi
Copy link
Member

Hey @Souvikpanda6 thanks so this issue you created is not an issue anymore?

@Souvikpanda6
Copy link
Author

Hi, The above mentioned issue is not an issue anymore. Moreover in the above comment i mentioned a reference, i want any resolution to that issue. thanks

@github-project-automation github-project-automation bot moved this from Backlog to ✅ Done in Engineering Effectiveness Board Oct 16, 2024
@prudhvigodithi prudhvigodithi self-assigned this Oct 16, 2024
@Souvikpanda6 Souvikpanda6 reopened this Oct 22, 2024
@github-project-automation github-project-automation bot moved this from ✅ Done to 🏗 In progress in Engineering Effectiveness Board Oct 22, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Engineering Effectiveness Board Oct 22, 2024
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
Status: ✅ Done
Development

No branches or pull requests

3 participants