Skip to content

Commit 5ca75ea

Browse files
authored
Merge pull request #440 from lonegunmanb/e-419
Add support for `maintenance_window_node_os` block
2 parents da5c54e + d923a9d commit 5ca75ea

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

examples/startup/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ module "aks" {
9191
},
9292
]
9393
}
94+
maintenance_window_node_os = {
95+
frequency = "Daily"
96+
interval = 1
97+
start_time = "07:00"
98+
utc_offset = "+01:00"
99+
duration = 16
100+
}
94101
net_profile_dns_service_ip = "10.0.0.10"
95102
net_profile_service_cidr = "10.0.0.0/16"
96103
network_plugin = "azure"

main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,28 @@ resource "azurerm_kubernetes_cluster" "main" {
378378
}
379379
}
380380
}
381+
dynamic "maintenance_window_node_os" {
382+
for_each = var.maintenance_window_node_os == null ? [] : [var.maintenance_window_node_os]
383+
content {
384+
day_of_month = maintenance_window_node_os.value.day_of_month
385+
day_of_week = maintenance_window_node_os.value.day_of_week
386+
duration = maintenance_window_node_os.value.duration
387+
frequency = maintenance_window_node_os.value.frequency
388+
interval = maintenance_window_node_os.value.interval
389+
start_date = maintenance_window_node_os.value.start_date
390+
start_time = maintenance_window_node_os.value.start_time
391+
utc_offset = maintenance_window_node_os.value.utc_offset
392+
week_index = maintenance_window_node_os.value.week_index
393+
394+
dynamic "not_allowed" {
395+
for_each = maintenance_window_node_os.value.not_allowed == null ? [] : maintenance_window_node_os.value.not_allowed
396+
content {
397+
end = not_allowed.value.end
398+
start = not_allowed.value.start
399+
}
400+
}
401+
}
402+
}
381403
dynamic "microsoft_defender" {
382404
for_each = var.microsoft_defender_enabled ? ["microsoft_defender"] : []
383405

variables.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,41 @@ variable "maintenance_window" {
654654
description = "(Optional) Maintenance configuration of the managed cluster."
655655
}
656656

657+
variable "maintenance_window_node_os" {
658+
type = object({
659+
day_of_month = optional(number)
660+
day_of_week = optional(string)
661+
duration = number
662+
frequency = string
663+
interval = number
664+
start_date = optional(string)
665+
start_time = optional(string)
666+
utc_offset = optional(string)
667+
week_index = optional(string)
668+
not_allowed = optional(set(object({
669+
end = string
670+
start = string
671+
})))
672+
})
673+
default = null
674+
description = <<-EOT
675+
- `day_of_month` -
676+
- `day_of_week` - (Optional) The day of the week for the maintenance run. Options are `Monday`, `Tuesday`, `Wednesday`, `Thurday`, `Friday`, `Saturday` and `Sunday`. Required in combination with weekly frequency.
677+
- `duration` - (Required) The duration of the window for maintenance to run in hours.
678+
- `frequency` - (Required) Frequency of maintenance. Possible options are `Daily`, `Weekly`, `AbsoluteMonthly` and `RelativeMonthly`.
679+
- `interval` - (Required) The interval for maintenance runs. Depending on the frequency this interval is week or month based.
680+
- `start_date` - (Optional) The date on which the maintenance window begins to take effect.
681+
- `start_time` - (Optional) The time for maintenance to begin, based on the timezone determined by `utc_offset`. Format is `HH:mm`.
682+
- `utc_offset` - (Optional) Used to determine the timezone for cluster maintenance.
683+
- `week_index` - (Optional) The week in the month used for the maintenance run. Options are `First`, `Second`, `Third`, `Fourth`, and `Last`.
684+
685+
---
686+
`not_allowed` block supports the following:
687+
- `end` - (Required) The end of a time span, formatted as an RFC3339 string.
688+
- `start` - (Required) The start of a time span, formatted as an RFC3339 string.
689+
EOT
690+
}
691+
657692
variable "microsoft_defender_enabled" {
658693
type = bool
659694
default = false

0 commit comments

Comments
 (0)