I am encountering a perplexing issue while attempting to provision an Azure Kubernetes Cluster Node Pool using Terraform. The error occurs during the resource provisioning phase for azurerm_kubernetes_cluster_node_pool
The error message I am encountering is as follows:
Error: Error creating Kubernetes Node Pool "example" (Kubernetes Cluster "example" / Resource Group "example-rg"): containerservice.ManagedClustersClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="Canceled" Message="Operation was canceled" Details=[] on main.tf line 6, in resource "azurerm_kubernetes_cluster_node_pool" "example": 6: resource "azurerm_kubernetes_cluster_node_pool" "example" { I have thoroughly reviewed the Terraform documentation and Azure documentation, but I'm still unable to determine the root cause of this issue. It appears to be related to the azurerm_kubernetes_cluster_node_pool resource, but I'm not sure what exactly is causing the cancellation error.
Could someone please provide insight into what might be causing this error and how it can be resolved? Any help or guidance would be greatly appreciated.
11 Answer
I tried to provision Azure Kubernetes Cluster Node Pool with Terraform I was able to provision the requirement successfully.
The error message you are seeing "Operation was canceled " usually suggests there is a problem, with the API request made while setting up the Kubernetes Node Pool in your Azure Kubernetes Service (AKS) cluster.
If the issue is intermittent, you can configure Terraform to retry the provisioning step. For example, you can set the retry and max_retries arguments in your Terraform resource block to automatically retry on failure:
resource "azurerm_kubernetes_cluster_node_pool" example" { retry = true max_retries = 3 } Here for this case, as it needs to as it requires proper permissions and authorization we can be able to provision the requirement as mentioned.
My Terraform configuration:
data "azurerm_resource_group" "example" { name = "demorg-vk" } resource "azurerm_kubernetes_cluster" "example" { name = "demoaksvkcluster" location = data.azurerm_resource_group.example.location resource_group_name = data.azurerm_resource_group.example.name dns_prefix = "exampleaks1" default_node_pool { name = "default" node_count = 1 vm_size = "Standard_D2_v2" } service_principal { client_id = "" client_secret = "" } } resource "azurerm_kubernetes_cluster_node_pool" "example" { name = "internal" kubernetes_cluster_id = azurerm_kubernetes_cluster.example.id vm_size = "Standard_DS2_v2" node_count = 1 } Output:

