diff --git a/main.tf b/main.tf index 8edaf315..9feb2969 100644 --- a/main.tf +++ b/main.tf @@ -138,6 +138,28 @@ resource "azurerm_kubernetes_cluster" "main" { tags = var.tags } +resource "azurerm_kubernetes_cluster_node_pool" "main" { + for_each = var.node_pools + name = each.key + kubernetes_cluster_id = azurerm_kubernetes_cluster.main.id + vm_size = each.value.vm_size + node_count = each.value.node_count + + // optional + availability_zones = lookup(each.value, "availability_zones", null) + enable_auto_scaling = lookup(each.value, "enable_auto_scaling", null) + max_count = lookup(each.value, "max_count", null) + min_count = lookup(each.value, "min_count", null) + max_pods = lookup(each.value, "max_pods", null) + node_taints = lookup(each.value, "node_taints", null) + os_disk_size_gb = lookup(each.value, "os_disk_size_gb", null) + os_type = lookup(each.value, "os_type", "Linux") + vnet_subnet_id = lookup(each.value, "vnet_subnet_id ", var.vnet_subnet_id) + lifecycle { + ignore_changes = [node_count] + } +} + resource "azurerm_log_analytics_workspace" "main" { count = var.enable_log_analytics_workspace ? 1 : 0