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?