Skip to content

Commit

Permalink
Merge pull request #168 from kbst/fixaksservices
Browse files Browse the repository at this point in the history
AKS: Fix flapping empty string in list of service_endpoints
  • Loading branch information
pst authored Mar 29, 2021
2 parents 979d3bf + b3b83bb commit 608123c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions azurerm/_modules/aks/vnet.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

resource "azurerm_virtual_network" "current" {
count = var.network_plugin == "azure" ? 1 : 0
count = var.network_plugin == "azure" ? 1 : 0

name = "vnet-aks-${terraform.workspace}-cluster"
address_space = var.vnet_address_space
Expand All @@ -9,12 +9,12 @@ resource "azurerm_virtual_network" "current" {
}

resource "azurerm_subnet" "current" {
count = var.network_plugin == "azure" ? 1 : 0
count = var.network_plugin == "azure" ? 1 : 0

name = "aks-node-subnet"
address_prefixes = var.subnet_address_prefixes
resource_group_name = data.azurerm_resource_group.current.name
virtual_network_name = azurerm_virtual_network.current[0].name
service_endpoints = var.subnet_service_endpoints == [""] ? null: var.subnet_service_endpoints

service_endpoints = length(var.subnet_service_endpoints) > 0 ? var.subnet_service_endpoints : null
}
8 changes: 5 additions & 3 deletions azurerm/cluster/configuration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ locals {

dns_prefix = lookup(local.cfg, "dns_prefix", "api")

vnet_address_space = split(",", lookup(local.cfg, "vnet_address_space", "10.0.0.0/8"))
subnet_address_prefixes = split(",", lookup(local.cfg, "subnet_address_prefixes", "10.1.0.0/16"))
subnet_service_endpoints = split(",", lookup(local.cfg, "subnet_service_endpoints", ""))
vnet_address_space = split(",", lookup(local.cfg, "vnet_address_space", "10.0.0.0/8"))
subnet_address_prefixes = split(",", lookup(local.cfg, "subnet_address_prefixes", "10.1.0.0/16"))

subnet_service_endpoints_lookup = lookup(local.cfg, "subnet_service_endpoints", "")
subnet_service_endpoints = local.subnet_service_endpoints_lookup != "" ? split(",", local.subnet_service_endpoints_lookup) : []

network_plugin = lookup(local.cfg, "network_plugin", "kubenet")
network_policy = lookup(local.cfg, "network_policy", "calico")
Expand Down

0 comments on commit 608123c

Please sign in to comment.