Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions azurerm/modules/azurerm-aks/aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ resource "azurerm_kubernetes_cluster" "default" {

default_node_pool {
# TODO: variablise below:
type = var.nodepool_type # "VirtualMachineScaleSets" # default
enable_auto_scaling = var.enable_auto_scaling
max_count = var.max_nodes
min_count = var.min_nodes
name = "default"
os_disk_size_gb = var.os_disk_size
vm_size = var.vm_size
node_count = var.min_nodes
vnet_subnet_id = azurerm_subnet.default.0.id
type = var.nodepool_type # "VirtualMachineScaleSets" # default
enable_auto_scaling = var.enable_auto_scaling
max_count = var.max_nodes
min_count = var.min_nodes
name = "default"
os_disk_size_gb = var.os_disk_size
vm_size = var.vm_size
node_count = var.min_nodes
vnet_subnet_id = azurerm_subnet.default.0.id
temporary_name_for_rotation = "default_tmp"
zones = var.enable_availability_zones ? var.availabilty_zones : null # Only available on provision
}

http_application_routing_enabled = false
Expand Down Expand Up @@ -93,12 +95,12 @@ resource "azurerm_kubernetes_cluster_node_pool" "additional" {
name = each.key
kubernetes_cluster_id = azurerm_kubernetes_cluster.default[0].id
vm_size = each.value.vm_size

enable_auto_scaling = each.value.auto_scaling
min_count = each.value.min_nodes
max_count = each.value.max_nodes
node_count = each.value.min_nodes
vnet_subnet_id = azurerm_subnet.default.0.id
enable_auto_scaling = each.value.auto_scaling
min_count = each.value.min_nodes
max_count = each.value.max_nodes
node_count = each.value.min_nodes
vnet_subnet_id = azurerm_subnet.default.0.id
zones = each.value.enable_availability_zones ? each.value.availabilty_zones : null # Only available on provision
}

# perform lookup on existing ACR for stages where we don't want to create an ACR
Expand Down
24 changes: 20 additions & 4 deletions azurerm/modules/azurerm-aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,12 @@ variable "node_count" {

variable "aks_node_pools" {
type = map(object({
vm_size = string,
auto_scaling = bool,
min_nodes = number,
max_nodes = number
vm_size = string,
auto_scaling = bool,
min_nodes = number,
max_nodes = number,
enable_availability_zones = bool
availabilty_zones = list(int)
}))
description = "Additional node pools as required by the platform"

Expand Down Expand Up @@ -379,6 +381,20 @@ variable "private_cluster_enabled" {
default = false
}

variable "enable_availability_zones" {
type = bool
description = "Enable Availability Zones in the Cluster"

default = false
}

variable "availabilty_zones" {
description = "Availability Zones requested for Cluster usage"
type = list(int)

default = [1, 2, 3]
}

###########################
# MISC SETTINGS
###########################
Expand Down