Setting Autoscale Rules on Azure AKS VirtualMachineScaleSets type cluster

Hi All,

Need help with managing VM Scale Set (Vmss) that was created as a result of
“azurerm_kubernetes_cluster”. I have created an AKS cluster with multiple node pools utilizing “azurerm_kubernetes_cluster_node_pool”. Now all that is great and it works.

The AKS cluster is running and node pools are up, great! When creating the K8s node pools of “VirtualMachineScaleSets” type, Azure Vmss get created. In my case 2 Vmss. Each set has manual scale enabled.

What I need is to configure a Custom autoscale. I know I can do that using “azurerm_autoscale_setting”. However, to do that I need to know the name of the VM scale set. And that where my problem is. I can’t seem to get that while creating the AKS node pools.

Question: How can I get either the name or the id of the Vmss that gets created so that I can pass it on to “azurerm_autoscale_setting” resource?

Thank you