Thank You for reaching out to Microsoft Q&A forum.
The error stated above indicates that the azurerm_kubernetes_cluster resource named aks has not been declared in the terraform configuration file or a typo error or incorrect resource reference and ensure the resource is defined properly in .tf files.
Could you please share the complete module structure of your terraform configuration files and also please share the tf script to check the issue in detail.
If the information is helpful, please click on "Accept Answer" and "Upvote"
If you have any queries, please do let us know, we will help you.