CloudNationHQ / terraform-azure-aks

Terraform module which creates azure kubernetes resources used by workloads and accelerators.
https://library.tf/modules/CloudNationHQ/aks/azure/latest
MIT License
0 stars 1 forks source link

Blocking bug: default_node_pool upgrade_settings incorrectly laid out #49

Closed cveld closed 6 months ago

cveld commented 6 months ago

Current situation:

Within the default_node_pool block:

dynamic "upgrade_settings" {
      for_each = {
        for k, v in try(var.cluster.node_pools.upgrade_settings, {}) : k => v
      }

      content {
        max_surge = upgrade_settings.value.default_node_pool.max_surge
      }
    }

As this for_each loop is reading from var.cluster.node_pools, this conflicts with another for_each that sets up a list of node pools within the resource "azurerm_kubernetes_cluster_node_pool" "pools".

Due to this conflict it is impossible to set max_surge on the default node pool or any upgrade_settings on additional node pools.

Proposed fix:

dynamic "upgrade_settings" {
      for_each = try(var.cluster.default_node_pool.upgrade_settings, null) != null ? { "default" = var.cluster.default_node_pool.upgrade_settings } : {}     

      content {
        max_surge = upgrade_settings.value.max_surge
      }
}