Skip to content

Instantly share code, notes, and snippets.

@ppshein
Last active June 12, 2021 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppshein/d4508cbd227baa371b6a19ab8ff7df12 to your computer and use it in GitHub Desktop.
Save ppshein/d4508cbd227baa371b6a19ab8ff7df12 to your computer and use it in GitHub Desktop.
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