AKS k8s id "resourcegroup" change to "resourceGroup" and Terraform forces replacement of node_pool

10/27/2021

I have a Kubernetes cluster resource and an extra node pool resource associated to that cluster. Everytime I run terraform plan, the plan is to replace the node pool because the reference to the kubernetes_cluster_id supposedly changed but because resourcegroups changed to resourceGroups which is stupid. I don't understand why this happend though. Any ideas?

  • Output of the plan:
~ kubernetes_cluster_id  = "/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster" -> "/subscriptions/subsciptionId/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster" # forces replacement

To be clearer, look at one right next to the other:

"/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster"
"/subscriptions/subscriptionId/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster"
  • main.tf
resource "azurerm_kubernetes_cluster" "aks" {
  name                = "myCluster"
  resource_group_name = "myResourceGroup"
  ...
}

resource "azurerm_kubernetes_cluster_node_pool" "nodepool" {
  ...
  kubernetes_cluster_id = azurerm_kubernetes_cluster.aks.id
  ...
  depends_on = [azurerm_kubernetes_cluster.aks,]
}
-- everspader
azure
kubernetes
terraform

0 Answers