Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: terraform_validate
exclude: common
args:
- --hook-config=--retry-once-with-cleanup=true
- --hook-config=--retry-once-with-cleanup=true
- id: terraform_tflint
alias: terraform_tflint_nocreds
name: terraform_tflint_nocreds
Expand Down
2 changes: 1 addition & 1 deletion .tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config {
module = true
call_module_type = "all"
}

plugin "aws" {
Expand Down
6 changes: 3 additions & 3 deletions aws/rds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ No modules.
| <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 |
| <a name="input_alert_message"></a> [alert\_message](#input\_alert\_message) | Message to prepend to alert notifications | `string` | `"Alert"` | no |
| <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 |
| <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 |
| <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 |
| <a name="input_connection_count_anomaly_deviations"></a> [connection\_count\_anomaly\_deviations](#input\_connection\_count\_anomaly\_deviations) | Standard deviations | `number` | `3` | no |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
Expand Down Expand Up @@ -89,7 +89,7 @@ No modules.
| <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 |
| <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 |
| <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 |
| <a name="input_renotify_interval"></a> [renotify\_interval](#input\_renotify\_interval) | Interval in minutes to re-send notifications about an alert | `number` | `0` | no |
| <a name="input_renotify_interval"></a> [renotify\_interval](#input\_renotify\_interval) | Interval in minutes to re-send notifications about an alert | `number` | `60` | no |
| <a name="input_runbook_link"></a> [runbook\_link](#input\_runbook\_link) | Runbook link to include in message | `string` | `null` | no |
| <a name="input_service"></a> [service](#input\_service) | Service associated with the monitored resource (leave blank to omit tag) | `string` | `null` | no |
| <a name="input_team"></a> [team](#input\_team) | Team supporting the monitored resource (leave blank to omit tag) | `string` | `null` | no |
Expand Down
14 changes: 10 additions & 4 deletions aws/rds/main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
locals {
# these must be defined but do not need to be overridden
monitor_alert_default_priority = null
monitor_warn_default_priority = null
# tflint-ignore: terraform_unused_declarations
monitor_alert_default_priority = null
# tflint-ignore: terraform_unused_declarations
monitor_warn_default_priority = null
# tflint-ignore: terraform_unused_declarations
monitor_nodata_default_priority = null

title_prefix = var.title_prefix == null ? "" : "[${var.title_prefix}]"
title_suffix = var.title_suffix == null ? "" : " (${var.title_suffix})"

# Add RDS-specific query filter to exclude
rds_query_filter = "{!engine:aurora*,${trimprefix(local.query_filter, "{")}"
}

resource "datadog_monitor" "connection_count_anomaly" {
Expand Down Expand Up @@ -129,8 +135,8 @@ resource "datadog_monitor" "used_storage" {
query = <<END
max(${var.used_storage_evaluation_window}):(
100 - ((
default(avg:aws.rds.free_storage_space${local.query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 0) /
default(avg:aws.rds.total_storage_space${local.query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 1)
default(avg:aws.rds.free_storage_space${local.rds_query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 0) /
default(avg:aws.rds.total_storage_space${local.rds_query_filter} by {dbinstanceidentifier,region,aws_account,env,datadog_managed}, 1)
) * 100)
) >= ${var.used_storage_threshold_critical}
END
Expand Down
Loading