Best Way to modularize terraform new relic dashboard, and make them customizable dashboards

I wanted to modularize terraform new relic dashboards in a repo and make them available as a source in a parent module (the actual root module of a service), but more importantly, make the dashboards customizable - basically have as many dashboard widgets as one desires - according to the needs of a given service/application using the new relic terraform modules as a source repo.

Would the best approach for that be by using for_each and in the service’s module { } block call using the new relic repo as a source, and using a file() call with a JSON or other file format containing the data for each of the customized the dashboard widgets, with key-value pairs for widget attributes like, title, visualization, nrql (the query), threshold_red, row, column and so on.

I wish I had the answer. I am looking for the same thing but not finding much luck. There does not seem to be a very robust userbase on here terraforming NR dashboards

Hi @SteeltownRiot , I actually was able to do it successfully, however that was with the newrelic_dashboard, which will break in late July, so it has to move to a newrelic_one_dashboard. It doesn’t appear my code will entirely work at this point, so I have yet to look at it. It’s on the table though. It was done by using locals in the root module, and passing a data mapping of the widgets in that locals to the dashboard module, and in that child (dashboard) module, using dynamic blocks to generate multiple widgets.

But again, that’s going to break soon and I have to take another look at things.

Hmmm. We are starting with NR1 for Terraform. I’ve got one of my engineers looking into it as well. If you figure out how to rejigger it for the new resource please, let me know.

Any chance you could share a bit more detail about how you made it work with Insights, at least? We are still new to HCL.

this discussion points to some of my code and the basic setup:

It’s a start and basic idea/setup, but I think the rest of the code will be breaking - the code in the dashboard(child) module and I don’t think it is shown in the above link - so I need to work on that and don’t have it handy.

1 Like