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

bug: linux_profile admin_username takes wrong value #19

Closed cveld closed 9 months ago

cveld commented 9 months ago

Currently the linux_profile block does not take the correct value as the for_each projection is not meaningful.

Current code:

 dynamic "linux_profile" {
    for_each = var.cluster.profile == "linux" ? { "default" = {} } : {}

    content {
      admin_username = try(linux_profile.value.username, "nodeadmin")
      ssh_key {
        key_data = azurerm_key_vault_secret.tls_public_key_secret[linux_profile.key].value
      }
    }
  }

Suggestion:

  dynamic "linux_profile" {
    for_each = var.cluster.profile == "linux" ? { "default" = {} } : {}

    content {
      admin_username = try(var.cluster.linux_admin_username, "nodeadmin")
      ssh_key {
        key_data = azurerm_key_vault_secret.tls_public_key_secret[linux_profile.key].value
      }
    }
  }
dkooll commented 9 months ago

Within the data structure there is already a profile property for either windows or linux. Therefore there is no real need to include it as well in the naming of individual properties.