Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TripathyC opened this issue Mar 11, 2024 · 1 comment

Comments

@TripathyC
Copy link

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

@TripathyC
Copy link
Author

To add more, this is what I have in my JSON inside the nrqlQueries block
"nrqlQueries": [ { "accountIds": [ ** ], "query": "**" } ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant