There are configuration items for Dashboard widgets that are not currently configureable. They are set/returned on the rawConfiguration field
After talking with the New Relic Dashboard Services team, the recommendation is to refactor all of the widgets to use rawConfiguration instead of the typed configs.
widget_areawidget_barwidget_billboardwidget_bulletwidget_funnelwidget_heatmapwidget_histogramwidget_linewidget_markdownwidget_piewidget_tablewidget_event_feedwidget_inventorywidget_jsonwidget_service_map{
"data": {
"actor": {
"entity": {
"guid": "<REDACTED>",
"name": "jt-test-manual",
"pages": [
{
"guid": "<REDACTED>",
"widgets": [
{
"configuration": {
"area": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "SELECT count(*) FROM Transaction TIMESERIES"
}
]
}
},
"rawConfiguration": {
"legend": {
"enabled": false
},
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "SELECT count(*) FROM Transaction TIMESERIES"
}
]
},
"title": "Area Widget",
"visualization": { "id": "viz.area" }
},
{
"configuration": {
"bar": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT average(duration) FACET appName "
}
]
}
},
"rawConfiguration": {
"facet": {
"showOtherSeries": false
},
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT average(duration) FACET appName "
}
]
},
"title": "Bar Widget",
"visualization": { "id": "viz.bar" }
},
{
"configuration": {
"billboard": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT count(*) COMPARE WITH 1 day ago"
}
],
"thresholds": []
},
},
"rawConfiguration": {
"dataFormatters": [
{
"name": "count",
"precision": 2,
"type": "humanized"
}
],
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT count(*) COMPARE WITH 1 day ago"
}
]
},
"title": "Billboard Widget",
"visualization": { "id": "viz.billboard" }
},
{
"configuration": null,
"rawConfiguration": {
"limit": 6000.345,
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT count(*)"
}
]
},
"title": "Bullet Widget",
"visualization": { "id": "viz.bullet" }
},
{
"configuration": null,
"rawConfiguration": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT funnel(response.status, WHERE name = 'WebTransaction/Expressjs/GET//', WHERE name = 'WebTransaction/Expressjs/GET//api/inventory')"
}
]
},
"title": "Funnel Widget",
"visualization": { "id": "viz.funnel" }
},
{
"configuration": null,
"rawConfiguration": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT histogram(duration, buckets: 100, width: 0.1) FACET appName "
}
]
},
"title": "Heatmap Widget",
"visualization": { "id": "viz.heatmap" }
},
{
"configuration": null,
"rawConfiguration": {
"legend": {
"enabled": false
},
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT histogram(duration * 100, buckets: 500, width: 1) "
}
]
},
"title": "Histogram Widget",
"visualization": { "id": "viz.histogram" }
},
{
"configuration": {
"line": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT average(duration * 1000) TIMESERIES"
}
]
}
},
"rawConfiguration": {
"legend": {
"enabled": true
},
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT average(duration * 1000) TIMESERIES"
}
],
"yAxisLeft": {
"max": 5,
"min": 1,
"zero": false
}
},
"title": "Line Widget",
"visualization": { "id": "viz.line" }
},
{
"configuration": {
"markdown": {
"text": "# Markdown Widget\n\nWith text"
}
},
"rawConfiguration": {
"text": "# Markdown Widget\n\nWith text"
},
"title": "",
"visualization": {
"id": "viz.markdown"
}
},
{
"configuration": {
"pie": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT sum(duration) FACET name "
}
]
}
},
"rawConfiguration": {
"facet": {
"showOtherSeries": false
},
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT sum(duration) FACET name "
}
]
},
"title": "Pie Widget",
"visualization": { "id": "viz.pie" }
},
{
"configuration": {
"table": {
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT average(duration) FACET appName "
}
]
}
},
"rawConfiguration": {
"dataFormatters": [
{
"name": "Avg duration",
"type": "humanized"
}
],
"facet": {
"showOtherSeries": true
},
"nrqlQueries": [
{
"accountId": <REDACTED>,
"query": "FROM Transaction SELECT average(duration) FACET appName "
}
]
},
"title": "Table Widget",
"visualization": { "id": "viz.table" }
}
]
}
]
}
}
}
}
Oh my, this seems major.
This is more than 1 PR worth of work, should move this to a milestone and break out the sub-components.
Perhaps related, would you happen to know why there are always changes to NR1 dashboard resources, despite identical Terraform config? Is this a known issue?
For example, most of the changes are akin to this:
~ widget_line {
~ column = 1 -> 9
~ height = 4 -> 3
id = "28914860"
~ row = 26 -> 24
~ title = "Traffic (rpm)" -> "Memory (GB)"
~ width = 5 -> 4
Effectively, it's treating as if the widgets have been moved around. Even when nothing's changed. When these planned changes are applied, still nothing changes.
They serve to pollute the logs quite severely when dealing with several large dashboards, as you can imagine.
@rdhar I have not specifically tested this, but my first guess is that the order of the widgets in the HCL vs what the API returns is not the same. The Terraform provider keeps the widgets in order of the config, and my guess is that the API returns them in Row/Column order. When comparing, TF sees a difference and complains, though the API doesn't require the widgets to be sent in order, so there is no change when applying.
One way to check is to look at all the widgets it is complaining about and see if the row and columns are being swapped. Looks like you have a lot of widgets on this dashboard, so a smaller test of two widgets would also work.
Not sure what the right provider fix would be here. Keeping order was explicitly chosen with an eye to automatic row/column calculation in the future.
The Terraform provider keeps the widgets in order of the config, and my guess is that the API returns them in Row/Column order…
I think you hit the nail on the head here. To demo, here's a working example of the issue in action. Despite no change in the TF config, the API will update the dashboard entity every. single. time.
Toggle view of code snippet…
terraform {
required_version = "~> 0.14.0"
required_providers {
newrelic = {
source = "newrelic/newrelic"
version = "~> 2.21.0"
}
}
}
provider "newrelic" {
account_id = 123456
api_key = "NRAK-ABC"
}
resource "newrelic_one_dashboard" "dashboard_layout" {
name = "#1211 Dashboard Layout"
page {
name = "#1211 Dashboard Layout"
widget_markdown {
title = "1 x 2"
row = 4
column = 1
width = 6
height = 3
}
widget_markdown {
title = "1 x 1"
row = 1
column = 1
width = 6
height = 3
}
}
}
Like you said, I'm not certain about the fix here either. I thought it might be related to the newrelic_alert_policy_channel List/Set issue #1130 fixed by PR #1259. But I'm not sure that applies in this case.
Hopefully, the above example helps narrow down testing for this issue's resolution. Thank you.