terraform-provider-grafana
terraform-provider-grafana copied to clipboard
grafana_dashboard resource creation intermittently fails with 422 error
Terraform Version
Terraform v1.1.7
- provider registry.terraform.io/grafana/grafana v1.23.0
Affected Resource(s)
- grafana_dashboard
Bug Description
I've noticed that trying to create multiple dashboards (~15 at the time) ends with 422 error for a couple of them They can be successfully retried without any modifications. It appears that for some reason provider sends empty POST request to grafana.
It's always reproducing for me on this amount:
Plan: 14 to add, 1 to change, 19 to destroy.
All dashboard resources have same configuration with overwrite = true
e.g. resource "grafana_dashboard" "some_dash_name" { config_json = file("../dashboards/k8s/some_dash_name.json") folder = grafana_folder.some_folder.id overwrite = true }
Debug Output
-----------------------------------------------------: timestamp=2022-06-01T16:17:30.035+0300 2022-06-01T16:17:30.099+0300 [INFO] provider.terraform-provider-grafana_v1.23.0: 2022/06/01 16:17:30 [DEBUG] Grafana API Request Details: ---[ REQUEST ]--------------------------------------- POST /api/dashboards/db HTTP/1.1 Host: ******* User-Agent: Go-http-client/1.1 Content-Length: 0 Authorization: Bearer ********** Content-Type: application/json Accept-Encoding: gzip
-----------------------------------------------------: timestamp=2022-06-01T16:17:30.098+0300 2022-06-01T16:17:30.517+0300 [INFO] provider.terraform-provider-grafana_v1.23.0: 2022/06/01 16:17:30 [DEBUG] Grafana API Response Details: ---[ RESPONSE ]-------------------------------------- HTTP/1.1 422 Unprocessable Entity Connection: close Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Wed, 01 Jun 2022 13:17:30 GMT Expires: -1 Pragma: no-cache Vary: Accept-Encoding X-Content-Type-Options: nosniff X-Xss-Protection: 1; mode=block
[ { "fieldNames": [ "Dashboard" ], "classification": "RequiredError", "message": "Required" } ]