Skip to content

Commit 26ce701

Browse files
committed
Add support for maintenance_window
1 parent a5c9390 commit 26ce701

6 files changed

Lines changed: 154 additions & 94 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ ENHANCEMENTS:
2020

2121
* Add `aci_connector_linux` addon. [#230](https://github.com/Azure/terraform-azurerm-aks/pull/230)
2222
* Restrict Terraform Core version for example cod to `>= 1.2`. [#253](https://github.com/Azure/terraform-azurerm-aks/pull/253)
23-
* Adds support for Ultra Disks by enabling the option. [#245](https://github.com/Azure/terraform-azurerm-aks/pull/245)
23+
* Adds support for Ultra Disks by enabling the option. [#245](https://github.com/Azure/terraform-azurerm-aks/pull/245)

README.md

Lines changed: 79 additions & 78 deletions
Large diffs are not rendered by default.

examples/named_cluster/main.tf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,16 @@ module "aks_cluster_name" {
5050
identity_ids = [azurerm_user_assigned_identity.test.id]
5151
identity_type = "UserAssigned"
5252
log_analytics_workspace_enabled = true
53-
net_profile_pod_cidr = "10.1.0.0/16"
54-
private_cluster_enabled = true
55-
rbac_aad_managed = true
56-
role_based_access_control_enabled = true
53+
maintenance_window = {
54+
allowed = [
55+
{
56+
day = "Sunday",
57+
hours = 23
58+
},
59+
]
60+
}
61+
net_profile_pod_cidr = "10.1.0.0/16"
62+
private_cluster_enabled = true
63+
rbac_aad_managed = true
64+
role_based_access_control_enabled = true
5765
}

examples/startup/main.tf

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,31 @@ module "aks" {
5555
ingress_application_gateway_subnet_cidr = "10.52.1.0/24"
5656
local_account_disabled = true
5757
log_analytics_workspace_enabled = true
58-
net_profile_dns_service_ip = "10.0.0.10"
59-
net_profile_docker_bridge_cidr = "170.10.0.1/16"
60-
net_profile_service_cidr = "10.0.0.0/16"
61-
network_plugin = "azure"
62-
network_policy = "azure"
63-
os_disk_size_gb = 60
64-
private_cluster_enabled = true
65-
rbac_aad_managed = true
66-
role_based_access_control_enabled = true
67-
sku_tier = "Paid"
68-
vnet_subnet_id = azurerm_subnet.test.id
58+
maintenance_window = {
59+
allowed = [
60+
{
61+
day = "Sunday",
62+
hours = 23
63+
},
64+
]
65+
not_allowed = [
66+
{
67+
start = "2035-01-01T20:00:00.00Z08:00",
68+
end = "2035-01-01T21:00:00.00Z08:00"
69+
},
70+
]
71+
}
72+
net_profile_dns_service_ip = "10.0.0.10"
73+
net_profile_docker_bridge_cidr = "170.10.0.1/16"
74+
net_profile_service_cidr = "10.0.0.0/16"
75+
network_plugin = "azure"
76+
network_policy = "azure"
77+
os_disk_size_gb = 60
78+
private_cluster_enabled = true
79+
rbac_aad_managed = true
80+
role_based_access_control_enabled = true
81+
sku_tier = "Paid"
82+
vnet_subnet_id = azurerm_subnet.test.id
6983

7084
agents_labels = {
7185
"node1" : "label1"

main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,28 @@ resource "azurerm_kubernetes_cluster" "main" {
149149
}
150150
}
151151
}
152+
dynamic "maintenance_window" {
153+
for_each = var.maintenance_window != null ? ["maintenance_window"] : []
154+
155+
content {
156+
dynamic "allowed" {
157+
for_each = var.maintenance_window.allowed
158+
159+
content {
160+
day = allowed.value.day
161+
hours = allowed.value.hours
162+
}
163+
}
164+
dynamic "not_allowed" {
165+
for_each = var.maintenance_window.not_allowed
166+
167+
content {
168+
end = not_allowed.value.end
169+
start = not_allowed.value.start
170+
}
171+
}
172+
}
173+
}
152174
dynamic "microsoft_defender" {
153175
for_each = var.microsoft_defender_enabled ? ["microsoft_defender"] : []
154176

variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,21 @@ variable "log_retention_in_days" {
271271
default = 30
272272
}
273273

274+
variable "maintenance_window" {
275+
type = object({
276+
allowed = optional(list(object({
277+
day = string
278+
hours = number
279+
})), []),
280+
not_allowed = optional(list(object({
281+
end = string
282+
start = string
283+
})), []),
284+
})
285+
description = "(Optional) Maintenance configuration of the managed cluster."
286+
default = null
287+
}
288+
274289
variable "microsoft_defender_enabled" {
275290
type = bool
276291
description = "(Optional) Is Microsoft Defender on the cluster enabled?"

0 commit comments

Comments
 (0)