Skip to content

Instantly share code, notes, and snippets.

@ppshein
Last active Jun 12, 2021
Embed
What would you like to do?
resource "newrelic_one_dashboard" "this" {
name = var.dashboard_name
permissions = "public_read_only"
# To create TABS in dashboard
dynamic "page" {
for_each = var.resources
content {
# To display TABS name in dashboard
name = page.value["bu"]
# To create graph in dashboard
dynamic "widget_line" {
# To create graph based on its title
for_each = page.value["title"]
content {
# To display 3 graphs in each row that all column values should be
# 1, 5, 9 (1st row)
# 1, 5, 9 (2nd row)
# that's why (current cell + 4)
column = (((widget_line.key % 3) * 4) + 1)
height = 4
# To display 3 graphs in each row that each rows values should be
# 1 (1st row)
# 5 (2nd row)
# 9 (3rd row)
# that's why (current row + 4)
row = (abs(format("%.0f", (widget_line.key / 3))) * 4) + 1
width = 4
title = upper(page.value["title"][widget_line.key])
nrql_query {
query = page.value["nrql_query"][widget_line.key]
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment