terraform-provider-newrelic icon indicating copy to clipboard operation
terraform-provider-newrelic copied to clipboard

Incompatibility of `jsonencode()` with `one_dashboard_raw` widgets

Open rdhar opened this issue 3 years ago • 6 comments

Summary

It appears that the newly-introduced one_dashboard_raw is incompatible with chart widgets composed with jsonencode().

Expected Behaviour

Since one_dashboard_raw requires JSON within its configuration field, I expected this to accept jsonencode() input as below.

widget {
  ~
  visualization_id = "viz.line"
  configuration = jsonencode({
    nrqlQueries = {
      accountId = 2172084
      query = "FROM Transaction SELECT count(duration) FACET appName TIMESERIES"
    }
  })
}

This should be formatted correctly, as confirmed on hcl2json. However, the following error is returned instead.

Error: maximum retries reached: An unexpected error has occurred, A downstream error occurred.,
[{"extensions":{},"message":"An unexpected error has occurred"}]

Actual Behaviour

The above snippet's explicit JSON variant works just fine.

widget {
  ~
  visualization_id = "viz.line"
  configuration    = <<-EOT
  {
    "nrqlQueries": [
      {
        "accountId": 2172084,
        "query": "FROM Transaction SELECT count(duration) FACET appName TIMESERIES"
      }
    ]
  }
  EOT
}

References

#1211 and #1308 with regards to the consolidation of dashboards widgets being refactored to use rawConfiguration.

Environment

  • Terraform: v1.0.3
  • Provider: v2.24.1
  • OS: Windows 10 Pro

Thanks for your time.

rdhar avatar Jul 26 '21 21:07 rdhar

Context

In order to confirm whether jsonencode() works at all, here's a working example of a Markdown widget.

widget {
  ~
  visualization_id = "viz.markdown"
  configuration = jsonencode({
    text = "Text content"
  })
}

rdhar avatar Jul 26 '21 21:07 rdhar

To expand on one_dashboard_raw, is there support yet for filtering on facets via linked entities guid or some other way?

EDIT: Logged separately in #1413.

rdhar avatar Jul 27 '21 12:07 rdhar

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Aug 19 '21 13:08 stale[bot]

This issue has been automatically closed due to a lack of activity for an extended period of time.

stale[bot] avatar Aug 26 '21 16:08 stale[bot]

#1308 related issue one_dashboard_raw

deshdeep-airwallex avatar Sep 06 '21 23:09 deshdeep-airwallex

Really promising to see this and #1413 being added to the New dashboard resource milestone.

rdhar avatar Mar 01 '22 23:03 rdhar

Just FYI we've recently add support for JSON dashboards: https://github.com/newrelic/terraform-provider-newrelic/discussions/2044

kidk avatar Oct 06 '22 07:10 kidk

Hey @kidk, that's pretty good-going and more or less deprecates this issue altogether. Thanks for the update!

rdhar avatar Oct 06 '22 15:10 rdhar