Skip to content

Commit

Permalink
Make a dynamic admin uri
Browse files Browse the repository at this point in the history
  • Loading branch information
asteel-gsa committed Jun 28, 2024
1 parent 1406cef commit b7dcff4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions terraform/shared/modules/newrelic/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion terraform/shared/modules/newrelic/logreview.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
locals {
dev = var.cf_space_name == "dev" ? "fac-dev.app.cloud.gov" : ""
preview = var.cf_space_name == "preview" ? "fac-preview.app.cloud.gov" : ""
staging = var.cf_space_name == "staging" ? "fac-staging.app.cloud.gov" : ""
prod = var.cf_space_name == "production" ? "app.fac.gov" : ""
admin_uri = coalesce(local.dev, local.preview, local.staging, local.prod)
}

resource "newrelic_one_dashboard" "log_review_dashboard" {
name = "FAC Log Review (${var.cf_space_name})"
permissions = "public_read_only"
Expand Down Expand Up @@ -149,7 +157,7 @@ resource "newrelic_one_dashboard" "log_review_dashboard" {
height = 3

nrql_query {
query = "SELECT count(`message` as `/admin/login/ hits`) FROM Log WHERE `message` LIKE 'app.fac.gov%/admin/login%' SINCE 7 days ago"
query = "SELECT count(`message` as `/admin/login/ hits`) FROM Log WHERE `message` LIKE '${local.admin_uri}%/admin/login%' SINCE 7 days ago"
}

legend_enabled = true
Expand Down

0 comments on commit b7dcff4

Please sign in to comment.