Skip to content

Commit

Permalink
Use subnet also in default node pool
Browse files Browse the repository at this point in the history
  • Loading branch information
zioproto committed Mar 28, 2024
1 parent 703ecda commit b6b7082
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ resource "azurerm_kubernetes_cluster" "this" {
orchestrator_version = var.orchestrator_version
os_sku = "Ubuntu"
tags = merge(var.tags, var.agents_tags)
vnet_subnet_id = lookup(module.vnet.vnet_subnets_name_id, "nodecidr")
zones = try([for zone in local.regions_by_name_or_display_name[var.location].zones : zone], null)
}
auto_scaler_profile {
Expand Down Expand Up @@ -222,7 +223,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "this" {
orchestrator_version = each.value.orchestrator_version
os_sku = each.value.os_sku
tags = var.tags
vnet_subnet_id = module.vnet.vnet_subnets_name_id["subnet"]
vnet_subnet_id = lookup(module.vnet.vnet_subnets_name_id, "nodecidr")
zones = each.value.zone == "" ? null : [each.value.zone]
}

Expand Down Expand Up @@ -256,7 +257,7 @@ module "vnet" {

resource_group_name = var.resource_group_name
subnets = {
subnet = {
nodecidr = {
address_prefixes = var.node_cidr != null ? [var.node_cidr] : ["10.31.0.0/16"]
}
}
Expand Down

0 comments on commit b6b7082

Please sign in to comment.