disaster37 / terraform-provider-kibana

Custom provider to handle Kibana API
MIT License
11 stars 21 forks source link

bug: kibana_object does not work with dashboards #34

Open nicholas-r-king opened 2 years ago

nicholas-r-king commented 2 years ago

File contains the exact contents of an exported dashboard from Kibana (saved object). Attempting to create this returns a 400 bad request from kibana/elasticsearch. Dashboard was created in the existing version of Kibana. (Not a version mismatch or something).

resource "kibana_object" "test" {
  name           = "terraform-test"
  data           = file("./json/${var.environment}/rhapsody-dashboard.ndjson")
  deep_reference = "true"
}

running "/usr/local/bin/terraform apply -input=false \"/atlantis/repos/sre/tf-workspaces/infra-central/453/default/cvg-elasticsearch/dashboards/dev-dashboards-elasticsearch-default.tfplan\"" in "/atlantis/repos/sre/tf-workspaces/infra-central/453/default/cvg-elasticsearch/dashboards": exit status 1 kibana_object.rhapsody-dashboard: Creating... ╷ │ Error: 400 Bad Request │ │ with kibana_object.test, │ on dashboards.tf line 1, in resource "kibana_object" "test": │ 1: resource "kibana_object" "test" { │ ╵

eloo commented 2 years ago

i guess you need to use the export_objects or @disaster37 ?

t0mmili commented 1 year ago

I was actually having the same issue and did some digging.

First of all tf with debug shows this: Response: {"statusCode":400,"error":"Bad Request","message":"Unexpected end of JSON input"}

But then it gets interesting :) When you put index-pattern from repos tests it works! But wait, let's format this json properly, with each key-value in new line. Oh, it doesn't work...

@disaster37, could you check if it's valid conclusion? Provider "doesn't like" new line chars in json?