Skip to content

Dashboard conversion from JSON to Terraform is dropping thresholds #1651

@umair-talabat

Description

@umair-talabat

Description

When I'm try dashboard conversion from JSON to Terraform using new relic cli, it is dropping thresholds from billboard widget.

Go Version

Provide the output of go version here please

Current behavior

When I'm try dashboard conversion from JSON to Terraform using new relic cli, it is dropping thresholds from billboard widget.

Expected behavior

When I'm try dashboard conversion from JSON to Terraform using new relic cli, it should convert thresholds of billboard widget.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create dashboard.
  2. Add billboard widget
  3. Add thresholds to billboard widget
  4. Export JSON
  5. Use newrelic cli to convert json to hcl cat dashboard.json | newrelic utils terraform dashboard --label my_dashboard_resource
  6. Check the converted hcl doesn't have thresholds

Debug Output (if applicable)

Additional Context

References or Related Issues

You can try with this json as well

{
  "name": "New Relic Terraform Example",
  "description": null,
  "permissions": "PUBLIC_READ_ONLY",
  "pages": [
    {
      "name": "New Relic Terraform Example",
      "description": null,
      "widgets": [
        {
          "title": "Requests per minute",
          "layout": {
            "column": 1,
            "row": 1,
            "width": 4,
            "height": 3
          },
          "linkedEntityGuids": null,
          "visualization": {
            "id": "viz.billboard"
          },
          "rawConfiguration": {
            "facet": {
              "showOtherSeries": false
            },
            "nrqlQueries": [
              {
                "accountIds": [
                  134
                ],
                "query": "FROM ServiceLevelSnapshot SELECT average(sliCompliance) WHERE entity.name='234' LIMIT 1"
              }
            ],
            "platformOptions": {
              "ignoreTimeRange": false
            },
            "thresholds": [
              {
                "alertSeverity": "WARNING",
                "value": 90
              },
              {
                "alertSeverity": "CRITICAL",
                "value": 95
              }
            ]
          }
        },
        {
          "title": "List of Transactions",
          "layout": {
            "column": 5,
            "row": 1,
            "width": 4,
            "height": 3
          },
          "linkedEntityGuids": null,
          "visualization": {
            "id": "viz.table"
          },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountId": 134,
                "query": "FROM Transaction SELECT *"
              }
            ],
            "platformOptions": {}
          }
        },
        {
          "title": "Average transaction duration, by application",
          "layout": {
            "column": 9,
            "row": 1,
            "width": 4,
            "height": 3
          },
          "linkedEntityGuids": [
            "1234"
          ],
          "visualization": {
            "id": "viz.bar"
          },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountId": 123,
                "query": "FROM Transaction SELECT average(duration) FACET appName"
              }
            ],
            "platformOptions": {}
          }
        }
      ]
    }
  ],
  "variables": []
}

This is the output, I'm getting:

widget_billboard {
      title = "Requests per minute"
      row = 1
      column = 1
      height = 3
      width = 4

      nrql_query {
        query = <<EOT
FROM Transaction SELECT rate(count(*), 1 minute)
EOT
      }
      facet_show_other_series = false
      legend_enabled = false
      ignore_time_range = false
      y_axis_left_min = 0
      y_axis_left_max = 0

      null_values {
        null_value = ""
      }

      units {
        unit = ""
      }

      colors {
        color = ""
      }
    }
    ```
    
    
    I understand widget_billboard might not support threshold, that's why thresholds are not being converted.
    Then let's add thresholds to widget_billboard. Happy to contribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions