diff --git a/indexer/indexer_monitors.tf b/indexer/indexer_monitors.tf index ebbceb7b..8f1aee5c 100644 --- a/indexer/indexer_monitors.tf +++ b/indexer/indexer_monitors.tf @@ -11,4 +11,5 @@ module "indexer_monitors" { team = var.monitoring_team url = var.indexer_url enable_precautionary_monitors = var.enable_precautionary_monitors + aws_account_id = var.monitoring_aws_account_id } diff --git a/indexer/variables.tf b/indexer/variables.tf index 416a412f..192754c4 100644 --- a/indexer/variables.tf +++ b/indexer/variables.tf @@ -332,6 +332,12 @@ variable "monitoring_team" { default = "v4-indexer" } +variable "monitoring_aws_account_id" { + type = string + description = "Account ID for the AWS account" + default = "" +} + variable "enable_precautionary_monitors" { type = bool description = "Whether to enable precautionary monitors" diff --git a/modules/indexer_monitors/locals.tf b/modules/indexer_monitors/locals.tf index 0552411d..57d283c3 100644 --- a/modules/indexer_monitors/locals.tf +++ b/modules/indexer_monitors/locals.tf @@ -6,6 +6,7 @@ locals { tick_frequency = 300 # 5 minutes retry_interval = 3000 # 3 seconds in milliseconds retry_count = 3 # 3 retries + snapshot_bucket_prefix = var.aws_account_id == "" ? var.environment : "${var.aws_account_id}-${var.environment}" api_http_synthetic_monitor_configurations = { "height" : { diff --git a/modules/indexer_monitors/monitors.tf b/modules/indexer_monitors/monitors.tf index 13952231..b2cc37f3 100644 --- a/modules/indexer_monitors/monitors.tf +++ b/modules/indexer_monitors/monitors.tf @@ -198,7 +198,7 @@ resource "datadog_monitor_json" "fast_sync_snapshots" { "id": 131752782, "name": "[${var.environment}] Indexer fast sync snapshots haven't been uploaded in the last day", "type": "query alert", - "query": "sum(last_1d):sum:aws.s3.put_requests{bucketname:${var.environment}-full-node-snapshots}.as_count() < 1", + "query": "sum(last_1d):sum:aws.s3.put_requests{bucketname:${local.snapshot_bucket_prefix}-full-node-snapshots}.as_count() < 1", "message": "Indexer fast sync snapshots haven't been uploaded in the last day. Please investigate the snapshotting full node.\n\n${local.monitor_suffix_literal}", "tags": [ "team:${var.team}", diff --git a/modules/indexer_monitors/variables.tf b/modules/indexer_monitors/variables.tf index e7d3b0e2..935322a7 100644 --- a/modules/indexer_monitors/variables.tf +++ b/modules/indexer_monitors/variables.tf @@ -42,3 +42,8 @@ variable "enable_precautionary_monitors" { type = bool description = "Whether to enable precautionary monitors" } + +variable "aws_account_id" { + type = string + description = "Account ID for the AWS account" +}