Skip to content

Commit

Permalink
Add window_size to postgres module
Browse files Browse the repository at this point in the history
  • Loading branch information
johnake committed Nov 27, 2023
1 parent 8c6c2e0 commit e1882be
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions aks/postgres/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ resource "azurerm_monitor_metric_alert" "memory" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_postgresql_flexible_server.main[0].id]
description = "Action will be triggered when memory use is greater than 75%"
window_size = var.window_size

criteria {
metric_namespace = "Microsoft.DBforPostgreSQL/flexibleServers"
Expand Down Expand Up @@ -178,6 +179,7 @@ resource "azurerm_monitor_metric_alert" "cpu" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_postgresql_flexible_server.main[0].id]
description = "Action will be triggered when cpu use is greater than 60%"
window_size = var.window_size

criteria {
metric_namespace = "Microsoft.DBforPostgreSQL/flexibleServers"
Expand Down Expand Up @@ -205,6 +207,7 @@ resource "azurerm_monitor_metric_alert" "storage" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_postgresql_flexible_server.main[0].id]
description = "Action will be triggered when storage use is greater than 75%"
window_size = var.window_size

criteria {
metric_namespace = "Microsoft.DBforPostgreSQL/flexibleServers"
Expand Down
1 change: 1 addition & 0 deletions aks/postgres/tfdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ No modules.
| <a name="input_service_name"></a> [service\_name](#input\_service\_name) | Name of the service | `string` | n/a | yes |
| <a name="input_service_short"></a> [service\_short](#input\_service\_short) | Short name of the service | `string` | n/a | yes |
| <a name="input_use_azure"></a> [use\_azure](#input\_use\_azure) | Whether to deploy using Azure Redis Cache service | `bool` | n/a | yes |
| <a name="input_window_size"></a> [window\_size](#input\_window\_size) | The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H | `string` | `"PT5M"` | no |

## Outputs

Expand Down
6 changes: 6 additions & 0 deletions aks/postgres/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ variable "azure_enable_monitoring" {
default = true
}

variable "window_size" {
type = string
default = "PT5M"
description = "The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H"
}

variable "azure_maintenance_window" {
type = object({
day_of_week = optional(number)
Expand Down
1 change: 1 addition & 0 deletions aks/redis/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ resource "azurerm_monitor_metric_alert" "memory" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_redis_cache.main[0].id]
description = "Action will be triggered when memory use is greater than 60%"
window_size = var.window_size

criteria {
metric_namespace = "Microsoft.Cache/redis"
Expand Down
1 change: 1 addition & 0 deletions aks/redis/tfdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ No modules.
| <a name="input_service_name"></a> [service\_name](#input\_service\_name) | Name of the service | `string` | n/a | yes |
| <a name="input_service_short"></a> [service\_short](#input\_service\_short) | Short name of the service | `string` | n/a | yes |
| <a name="input_use_azure"></a> [use\_azure](#input\_use\_azure) | Whether to deploy using Azure Redis Cache service | `bool` | n/a | yes |
| <a name="input_window_size"></a> [window\_size](#input\_window\_size) | The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H | `string` | `"PT5M"` | no |

## Outputs

Expand Down
7 changes: 7 additions & 0 deletions aks/redis/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,10 @@ variable "azure_patch_schedule" {
}))
default = []
}

variable "window_size" {
type = string
default = "PT5M"
description = "The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H"
}

0 comments on commit e1882be

Please sign in to comment.