grafana / terraform-provider-grafana

Terraform Grafana provider
https://www.terraform.io/docs/providers/grafana/
Mozilla Public License 2.0
430 stars 228 forks source link

[Bug]: &{ <nil> } (*models.ErrorResponseBody) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface #1851

Open darrinholst opened 2 weeks ago

darrinholst commented 2 weeks ago

Terraform Version

1.9.8

Terraform Grafana Provider Version

3.10.0

Grafana Version

11.2.0

Affected Resource(s)

Terraform Configuration Files

terraform {
  backend "http" {
  }

  required_providers {
    grafana = {
      source = "grafana/grafana"
    }
  }
}

provider "grafana" {
  url = "https://grafana.mycompany.com/"
}

resource "grafana_dashboard" "test-operations" {
  config_json = file("../grafana/operations-dashboard-test.json")
}

resource "grafana_dashboard" "prod-operations" {
  config_json = file("../grafana/operations-dashboard-prod.json")
}

Expected Behavior

should have updated the dashboard

Actual Behavior

get the following error

grafana_dashboard.prod-operations: Still modifying... [id=0:_mRttZmnz, 10s elapsed]
grafana_dashboard.test-operations: Still modifying... [id=0:uPecpWm7z, 10s elapsed]
2024-10-18T1[6](https://gitlab.com/-/jobs/8126384715#L6):25:21.939Z [ERROR] provider.terraform-provider-grafana_v3.10.0: Response contains error diagnostic: diagnostic_detail="" tf_proto_version=5.6 tf_provider_addr=registry.terraform.io/grafana/grafana tf_req_id=f8954[7](https://gitlab.com/-/jobs/8126384715#L7)d4-255b-76b2-420a-56aca8d5cfc8 @caller=github.com/hashicorp/terraform-plugin-go@v0.24.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_severity=ERROR diagnostic_summary="&{ <nil> } (*models.ErrorResponseBody) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface" tf_resource_type=grafana_dashboard tf_rpc=ApplyResourceChange timestamp=2024-10-18T16:25:21.939Z
2024-10-18T16:25:21.942Z [ERROR] provider.terraform-provider-grafana_v3.10.0: Response contains error diagnostic: diagnostic_detail="" diagnostic_summary="&{ <nil> } (*models.ErrorResponseBody) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface" tf_proto_version=5.6 tf_req_id=a2d[8](https://gitlab.com/-/jobs/8126384715#L8)940d-1820-5126-03bf-bc3d221664c2 @caller=github.com/hashicorp/terraform-plugin-go@v0.24.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto tf_resource_type=grafana_dashboard tf_rpc=ApplyResourceChange diagnostic_severity=ERROR tf_provider_addr=registry.terraform.io/grafana/grafana timestamp=2024-10-18T16:25:21.942Z
2024-10-18T16:25:21.943Z [DEBUG] State storage *remote.State declined to persist a state snapshot
2024-10-18T16:25:21.943Z [ERROR] vertex "grafana_dashboard.test-operations" error: &{ <nil> } (*models.ErrorResponseBody) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface
2024-10-18T16:25:21.[9](https://gitlab.com/-/jobs/8126384715#L9)45Z [DEBUG] State storage *remote.State declined to persist a state snapshot
2024-10-18T16:25:21.945Z [ERROR] vertex "grafana_dashboard.prod-operations" error: &{ <nil> } (*models.ErrorResponseBody) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface
2024-[10](https://gitlab.com/-/jobs/8126384715#L10)-18T16:25:21.946Z [DEBUG] states/remote: state read serial is: 417; serial is: 417
2024-10-18T16:25:21.946Z [DEBUG] states/remote: state read lineage is: a99d99c4-abd1-016f-a1ac-9673c04cece0; lineage is: a99d99c4-abd1-016f-a1ac-9673c04cece0

Steps to Reproduce

terraform apply

Important Factoids

plan works, but when I apply it throws that error.

It last worked on 9/6/2024

References

No response

mlabbe commented 2 days ago

I also had this issue with 3.11.0, though it affected tofu plan. It puzzled me because I had made no changes to my terraform scripts since it last worked.

Unfortunately, this is the error for a generic response that can't be parsed. In my case, it was because an nginx reverse proxy added an authbasic denial into the response. This caused a failure to parse, and this error message was the result.

Until a better diagnostic or error message is returned by the provider, the maintainers of this github repo may be served by including the question "Is the request to Grafana being reverse proxied?", and perhaps the followup question "Did you try it without the reverse proxy?" as part of the bug report template.

a-besson commented 1 day ago

Same issue on grafana docker img 11.2.0-ubuntu, terraform 1.7, grafana provider 3.7.0.