Skip to content

While converting JSON to TF resource account_id gets ignored in widget query #1567

Open
@TripathyC

Description

Description

I am trying to convert some of my dashboards created manually to Terraform. For which I am using the steps provided in https://registry.terraform.io/providers/newrelic/newrelic/latest/docs/resources/one_dashboard#use-the-new-relic-cli-to-convert-an-existing-dashboard
There was no mention here on how to export the terraform into a file but I figured that out by adding -o file.tf to the command & it did the work.

Go Version

I dont use Go.

Current behavior

When I tried to use the newrelic cli to convert my dashboard.json to a Terraform resource, the account_id gets ignored & not present in the widgets.
It comes like this.

nrql_query {
        query = <<EOT
query
EOT
      }

Expected behavior

The block nrql_query should also have the account_id associated with that query.
Like this

nrql_query {
        account_id = ***
        query = <<EOT
query
EOT
      }

Steps To Reproduce

Steps to reproduce the behavior:

  1. Export any dashboard & save as Json file, lets say file is dashboard.json. And make sure you are in a multi account Newrelic organization account where your query needs to be ran on a specific account.
  2. Make sure to install newrelic cli :)
  3. Then run cat dashboard.json | newrelic utils terraform dashboard --label my_dashboard_resource -o dashboard.tf
  4. Check in the newly created dashboard.tf file & you will see no account_id attribute is present inside nrql_query block.

References or Related Issues

https://registry.terraform.io/providers/newrelic/newrelic/latest/docs/resources/one_dashboard#use-the-new-relic-cli-to-convert-an-existing-dashboard

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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