Skip to content

Commit

Permalink
Merge pull request #252 from Azure/fix-baseline-vnet
Browse files Browse the repository at this point in the history
fix baseline network scope role assignment
  • Loading branch information
hieumoscow committed Sep 10, 2021
2 parents 0f5eca2 + 538ecb1 commit ee05f94
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ resource "azurerm_role_assignment" "kubelet_noderg_vmcontrib" {

# Separate subnet
resource "azurerm_role_assignment" "kubelet_subnets_networkcontrib" {
for_each = toset(lookup(var.vnets[var.aks_cluster_vnet_key], "subnet_keys", [true]))
for_each = toset(try(var.vnets[var.aks_cluster_vnet_key].subnet_keys, [var.vnets[var.aks_cluster_vnet_key].key]))

scope = try(each.value == true, false) ? local.remote.vnets[var.vnets[var.aks_cluster_vnet_key].lz_key][var.vnets[var.aks_cluster_vnet_key].key].id : local.remote.vnets[var.vnets[var.aks_cluster_vnet_key].lz_key][var.vnets[var.aks_cluster_vnet_key].key].subnets[each.value].id
scope = try(var.vnets[var.aks_cluster_vnet_key].subnet_keys != null, false) ? local.remote.vnets[var.vnets[var.aks_cluster_vnet_key].lz_key][var.vnets[var.aks_cluster_vnet_key].key].subnets[each.value].id : local.remote.vnets[var.vnets[var.aks_cluster_vnet_key].lz_key][var.vnets[var.aks_cluster_vnet_key].key].id
role_definition_name = "Network Contributor"
principal_id = coalesce(
try(local.remote.aks_clusters[var.aks_clusters[var.aks_cluster_key].lz_key][var.aks_cluster_key].identity[0].principal_id, null),
Expand Down

0 comments on commit ee05f94

Please sign in to comment.