elastic / terraform-provider-elasticstack

Terraform provider for Elastic Stack
https://registry.terraform.io/providers/elastic/elasticstack/latest/docs
Apache License 2.0
173 stars 93 forks source link

[bug] bad error upon importing data view #917

Open Alfaxomo opened 1 week ago

Alfaxomo commented 1 week ago

Is your feature request related to a problem? Please describe.

I recently ran into an issue importing data views via the elasticstack_kibana_data_view [1] where the terraform was returning a 500 Internal Server Error error:

│ Error: Unable to read data view
│
│ Failed with: {"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred. Check Kibana server logs for details."}

It's possible that a 500 error was being produced by Kibana although I didn't find any (using elastic cloud), but the problem turned out to be that I was using the cluster_uuid and not the space as the destination for the import. The documentation does have an import command listed, but for every other resource I'd imported, I had used cluster_uuid and it did not remotely occur to me that this would be causing the problem considering the error message. It would have been nice if the provider had detected the incorrect usage of the import command and pointed me in that direction.

[1] https://registry.terraform.io/providers/elastic/elasticstack/latest/docs/resources/kibana_data_view

Describe the resource you would like to have implemented. An accurate error message for importing data views

Describe the solution you'd like An error message that makes the actual root cause of the problem clear.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.