Migration from agent_pool_profile to default_node_pool


I am currently upgrading my terraform stack with azurerm from the version 1.x to the version 2.x.

I make all the changes from the terraform files, but when trying to apply the configuration, I am getting the following error:

Error: flattening default_node_pool: The Default Agent Pool “” was not found

After some investigation in a new deployed stack and the old one, I can see that the block agent_pool_profile is existing in the old terraform state file, but has been replaced by default_node_pool in the new terraform state file.

Which is also mentioned here https://www.terraform.io/docs/providers/azurerm/guides/2.0-upgrade-guide.html#removal-of-deprecated-fields-data-sources-and-resources

How can I upgrade my stack using k8s with that kind of changes? (I just hope I should not update the tfstate file manually :sweat_smile:)

Thank you!

Having the same issue trying to migrate from 1.x to 2.x. I’ve modified the block to default_node_pool but appears that its still attempting to check for a Defautl Agent Pool "" even though there’s a name within the default_node_pool block.

Any advice on migrating?

I had identical issue. The problem was that my AKS cluster default nodepool had mode USER instead of SYSTEM. Old output from az aks nodepool list

Name     OsType    VmSize           Count    MaxPods    ProvisioningState    Mode

-------  --------  ---------------  -------  ---------  -------------------  ------

default  Linux     Standard_DS4_v2  0        110        Succeeded            User

So the fix was to change the mode to SYSTEM

az aks nodepool update -g GROUP--cluster-name CLUSTER_NAME -n default --mode system

and then everything worked


Thanks Bud, This solved the issue.

I was really hoping that this would resolve my issue but i get new error when running the az aks nodepool update command

“BadRequestError: Operation failed with status: ‘Bad Request’. Details: AgentPool APIs supported only for clusters with VMSS agentpools. For more information, please check https://aka.ms/multiagentpoollimitations

might be useful for folks who are wondering , how to check if your cluster is User/SYSTEM

az aks nodepool show --cluster-name name -g resource-group --name default --output table