From 1f4b7a07277ce7778542cdea43c6c1e16c6eec58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20MARMOL?= Date: Tue, 20 Feb 2024 18:24:38 +0100 Subject: [PATCH 1/2] AZ-1355: Add autoupgrade setting --- README.md | 1 + r-aks.tf | 1 + variables-aks-light.tf | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index a7bff47..3255e87 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,7 @@ module "aks" { | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | aci\_subnet\_id | ID of the Subnet for ACI virtual-nodes. | `string` | `null` | no | +| aks\_automatic\_channel\_upgrade | The upgrade channel for this Kubernetes Cluster. Possible values are `patch`, `rapid`, `node-image` and `stable`. Setting this field to `null` sets this value to none. | `string` | `"patch"` | no | | aks\_http\_proxy\_settings | Azure Kubernetes Service HTTP proxy settings. URLs must be in format `http(s)://fqdn:port/`. When setting the `no_proxy_list` parameter, the AKS Private Endpoint domain name and the AKS VNet CIDR (or Subnet CIDRs) must be added to the list. |
object({
https_proxy_url = optional(string)
http_proxy_url = optional(string)
trusted_ca = optional(string)
no_proxy_list = optional(list(string), [])
})
| `null` | no | | aks\_network\_mode | Azure Kubernetes Service network mode to use. Only available with Azure CNI. | `string` | `null` | no | | aks\_network\_plugin | Azure Kubernetes Service network plugin to use. Possible names are `azure` and `kubenet`. Possible CNI modes are `None`, `Overlay` and `Cilium` for Azure CNI and `None` for Kubenet. Changing this forces a new resource to be created. |
object({
name = optional(string, "azure")
cni_mode = optional(string, "overlay")
})
| `{}` | no | diff --git a/r-aks.tf b/r-aks.tf index 8052ddf..9c1f772 100644 --- a/r-aks.tf +++ b/r-aks.tf @@ -11,6 +11,7 @@ resource "azurerm_kubernetes_cluster" "aks" { # Cluster config kubernetes_version = coalesce(var.kubernetes_version, data.azurerm_kubernetes_service_versions.versions.latest_version) + automatic_channel_upgrade = var.aks_automatic_channel_upgrade sku_tier = var.aks_sku_tier node_resource_group = local.aks_nodes_rg_name http_application_routing_enabled = var.http_application_routing_enabled diff --git a/variables-aks-light.tf b/variables-aks-light.tf index d6ec7b5..4b32251 100644 --- a/variables-aks-light.tf +++ b/variables-aks-light.tf @@ -346,3 +346,9 @@ variable "vnet_integration" { error_message = "var.vnet_integration.subnet_id must be set when VNet integration is enabled." } } + +variable "aks_automatic_channel_upgrade" { + description = "The upgrade channel for this Kubernetes Cluster. Possible values are `patch`, `rapid`, `node-image` and `stable`. Setting this field to `null` sets this value to none." + type = string + default = "patch" +} From 04a29b819e44183bcffe3eaaa69db26ad2d2ed50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20MARMOL?= Date: Wed, 21 Feb 2024 09:26:57 +0100 Subject: [PATCH 2/2] AZ-1355: Add variable validation --- variables-aks-light.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/variables-aks-light.tf b/variables-aks-light.tf index 4b32251..88cbe7c 100644 --- a/variables-aks-light.tf +++ b/variables-aks-light.tf @@ -351,4 +351,8 @@ variable "aks_automatic_channel_upgrade" { description = "The upgrade channel for this Kubernetes Cluster. Possible values are `patch`, `rapid`, `node-image` and `stable`. Setting this field to `null` sets this value to none." type = string default = "patch" + validation { + condition = try(contains(["patch", "rapid", "node-image", "stable"], var.aks_automatic_channel_upgrade), false) || var.aks_automatic_channel_upgrade == null + error_message = "The upgrade channel must be one of the following values: patch, rapid, node-image, stable or null." + } }