Skip to content

Commit df7b7b4

Browse files
authored
Merge pull request #12 from rhythmictech/ENG-4329
ensure rds used_storage monitor excludes aurora instances
2 parents 942bada + fd02a5f commit df7b7b4

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: terraform_validate
1111
exclude: common
1212
args:
13-
- --hook-config=--retry-once-with-cleanup=true
13+
- --hook-config=--retry-once-with-cleanup=true
1414
- id: terraform_tflint
1515
alias: terraform_tflint_nocreds
1616
name: terraform_tflint_nocreds

.tflint.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
config {
2-
module = true
2+
call_module_type = "all"
33
}
44

55
plugin "aws" {

aws/rds/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ No modules.
4444
| <a name="input_alert_critical_priority"></a> [alert\_critical\_priority](#input\_alert\_critical\_priority) | Priority for alerts within critical threshold (P1-P5, uses monitor defaults if not specified) | `string` | `null` | no |
4545
| <a name="input_alert_message"></a> [alert\_message](#input\_alert\_message) | Message to prepend to alert notifications | `string` | `"Alert"` | no |
4646
| <a name="input_alert_nodata_priority"></a> [alert\_nodata\_priority](#input\_alert\_nodata\_priority) | Priority for alerts within warning threshold (P1-P5, uses monitor defaults if not specified) | `string` | `null` | no |
47-
| <a name="input_base_tags"></a> [base\_tags](#input\_base\_tags) | Base tags (key:value format) to add to this type of check (combined with `local.tags` and `var.additional_tags`, generally you should not change this) | `list(string)` | <pre>[<br> "resource:rds"<br>]</pre> | no |
47+
| <a name="input_base_tags"></a> [base\_tags](#input\_base\_tags) | Base tags (key:value format) to add to this type of check (combined with `local.tags` and `var.additional_tags`, generally you should not change this) | `list(string)` | <pre>[<br/> "resource:rds"<br/>]</pre> | no |
4848
| <a name="input_connection_count_anomaly_deviations"></a> [connection\_count\_anomaly\_deviations](#input\_connection\_count\_anomaly\_deviations) | Standard deviations | `number` | `3` | no |
4949
| <a name="input_connection_count_anomaly_enabled"></a> [connection\_count\_anomaly\_enabled](#input\_connection\_count\_anomaly\_enabled) | Enable CPU utilization anomaly monitor | `bool` | `true` | no |
50-
| <a name="input_connection_count_anomaly_evaluation_window"></a> [connection\_count\_anomaly\_evaluation\_window](#input\_connection\_count\_anomaly\_evaluation\_window) | Evaluation window for monitor (`last_?m` (1, 5, 10, 15, or 30), `last_?h` (1, 2, or 4), or `last_1d`] | `string` | `"last_1h"` | no |
50+
| <a name="input_connection_count_anomaly_evaluation_window"></a> [connection\_count\_anomaly\_evaluation\_window](#input\_connection\_count\_anomaly\_evaluation\_window) | Evaluation window for monitor (`last_?m` (1, 5, 10, 15, or 30), `last_?h` (1, 2, or 4), or `last_1d`] | `string` | `"last_4h"` | no |
5151
| <a name="input_connection_count_anomaly_no_data_window"></a> [connection\_count\_anomaly\_no\_data\_window](#input\_connection\_count\_anomaly\_no\_data\_window) | No data threshold (in minutes, 0 to disable) | `number` | `10` | no |
5252
| <a name="input_connection_count_anomaly_recovery_window"></a> [connection\_count\_anomaly\_recovery\_window](#input\_connection\_count\_anomaly\_recovery\_window) | Recovery window for anomaly monitor (`last_?m` (1, 5, 10, 15, or 30), `last_?h` (1, 2, or 4), or `last_1d`] | `string` | `"last_15m"` | no |
5353
| <a name="input_connection_count_anomaly_rollup"></a> [connection\_count\_anomaly\_rollup](#input\_connection\_count\_anomaly\_rollup) | Rollup interval (must be sized based on evaluation window/span and seasonaility) | `number` | `60` | no |
@@ -89,7 +89,7 @@ No modules.
8989
| <a name="input_notify_prod_override"></a> [notify\_prod\_override](#input\_notify\_prod\_override) | List of notifications for 12x5 prod alerts in critical threshold (uses `notify_default` otherwise) | `list(string)` | `[]` | no |
9090
| <a name="input_notify_recovery_override"></a> [notify\_recovery\_override](#input\_notify\_recovery\_override) | List of notifications for alert recovery (uses `notify_default` otherwise) | `list(string)` | `[]` | no |
9191
| <a name="input_notify_warn_override"></a> [notify\_warn\_override](#input\_notify\_warn\_override) | List of notifications for alerts in warning threshold (uses `notify_default` otherwise) | `list(string)` | `[]` | no |
92-
| <a name="input_renotify_interval"></a> [renotify\_interval](#input\_renotify\_interval) | Interval in minutes to re-send notifications about an alert | `number` | `0` | no |
92+
| <a name="input_renotify_interval"></a> [renotify\_interval](#input\_renotify\_interval) | Interval in minutes to re-send notifications about an alert | `number` | `60` | no |
9393
| <a name="input_runbook_link"></a> [runbook\_link](#input\_runbook\_link) | Runbook link to include in message | `string` | `null` | no |
9494
| <a name="input_service"></a> [service](#input\_service) | Service associated with the monitored resource (leave blank to omit tag) | `string` | `null` | no |
9595
| <a name="input_team"></a> [team](#input\_team) | Team supporting the monitored resource (leave blank to omit tag) | `string` | `null` | no |

aws/rds/main.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
locals {
22
# these must be defined but do not need to be overridden
3-
monitor_alert_default_priority = null
4-
monitor_warn_default_priority = null
3+
# tflint-ignore: terraform_unused_declarations
4+
monitor_alert_default_priority = null
5+
# tflint-ignore: terraform_unused_declarations
6+
monitor_warn_default_priority = null
7+
# tflint-ignore: terraform_unused_declarations
58
monitor_nodata_default_priority = null
69

710
title_prefix = var.title_prefix == null ? "" : "[${var.title_prefix}]"
811
title_suffix = var.title_suffix == null ? "" : " (${var.title_suffix})"
12+
13+
# Add RDS-specific query filter to exclude
14+
rds_query_filter = "{!engine:aurora*,${trimprefix(local.query_filter, "{")}"
915
}
1016

1117
resource "datadog_monitor" "connection_count_anomaly" {
@@ -129,8 +135,8 @@ resource "datadog_monitor" "used_storage" {
129135
query = <<END
130136
max(${var.used_storage_evaluation_window}):(
131137
100 - ((
132-
default(avg:aws.rds.free_storage_space${local.query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 0) /
133-
default(avg:aws.rds.total_storage_space${local.query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 1)
138+
default(avg:aws.rds.free_storage_space${local.rds_query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 0) /
139+
default(avg:aws.rds.total_storage_space${local.rds_query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 1)
134140
) * 100)
135141
) >= ${var.used_storage_threshold_critical}
136142
END

0 commit comments

Comments
 (0)