error on existing AKS 1.27.3 with Azurerm 2.99.0

216 views Asked by At

I am getting below error, On currently deployed Kubernetes terraform from registery

https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/resources/kubernetes_cluster '

it was working last week with Kubernetes version 1.27.3, two days ago MS removed 1.27.3 and now available version is 1.27.9, But even when I am trying to upgrade it giving below, I tried to use data block with azurerm 3.34.0 version but same error

'

'

;

containerservice.ManagedClustersClient#Get: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="NoRegisteredProviderFound" Message="No registered resource provider found for location 'westus2' and API version '2022-01-02-preview' for type 'managedClusters'. The supported api-versions are '2017-08-31, 2018-03-31, 2019-02-01, 2019-04-01, 2019-06-01, 2019-08-01, 2019-10-01, 2019-11-01, 2020-01-01, 2020-02-01, 2020-03-01, 2020-04-01, 2020-06-01, 2020-07-01, 2020-09-01, 2020-11-01, 2020-12-01, 2021-02-01, 2021-03-01, 2021-05-01, 2021-07-01, 2021-08-01, 2021-09-01, 2021-10-01, 2022-01-01, 2022-02-01, 2022-03-01, 2022-04-01, 2022-06-01, 2022-07-01, 2022-07-02-preview, 2022-08-01, 2022-08-02-preview, 2022-08-03-preview, 2022-09-01, 2022-09-02-preview, 2022-10-02-preview, 2022-11-01, 2022-11-02-preview, 2023-01-01, 2023-01-02-preview, 2023-02-01, 2023-02-02-preview, 2023-03-01, 2023-03-02-preview, 2023-04-01, 2023-04-02-preview, 2023-05-01, 2023-05-02-preview, 2023-06-01, 2023-06-02-preview, 2023-07-01, 2023-07-02-preview, 2023-08-01, 2023-08-02-preview, 2023-09-01, 2023-09-02-preview, 2023-10-01, 2023-10-02-preview, 2023-11-01, 2023-11-02-preview, 2024-01-01, 2024-01-02-preview'. The supported locations are 'australiacentral, australiacentral2, australiaeast, australiasoutheast, brazilsouth, brazilsoutheast, canadacentral, canadaeast, centralindia, centralus, eastasia, eastus, eastus2, francecentral, francesouth, germanynorth, germanywestcentral, israelcentral, italynorth, japaneast, japanwest, jioindiacentral, jioindiawest, koreacentral, koreasouth, northcentralus, northeurope, norwayeast, norwaywest, polandcentral, qatarcentral, southafricanorth, southafricawest, southcentralus, southindia, southeastasia, swedencentral, switzerlandnorth, switzerlandwest, uaecentral, uaenorth, uksouth, ukwest, westcentralus, westeurope, westus, westus2, westus3'

How do I fix the error, AS MS ended version 1.27.3 and when I ma changing 1.27.3 to 1.27.9

It is giving same above error

Any advise where I don't need to re-create the resource??

1

There are 1 answers

2
Vinay B On BEST ANSWER

I tried Resolving Azure Kubernetes Service Deployment Errors with Terraform in West US 2 Region and I was able to provision the requirement successfully

The cause of the error is that the westus2 location does not support the Azure Kubernetes Service (AKS) API version you are using. The Azure API version (2022-01-02-preview) that you have specified in your Terraform configuration or by the Terraform AzureRM provider is the issue, not the Kubernetes version (1.27.3 to 1.27.9).

To fix this issue, make sure you are using the most recent version of the Terraform AzureRM provider. You said you tried version 3.34.0, but check if there is a newer version that has updated API versions or fixes for this problem.

To prevent the error message, ensure that your Terraform configuration is compatible with one of the API versions that the managedClusters resource accepts in westus2. If you have specified the API version yourself, switch to a valid version from the error message and when using the azurerm_kubernetes_cluster resource, avoid setting the API version explicitly unless required and execute a terraform refresh to sync the state with the actual infrastructure.

My terraform configruation:

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "aks_rg" {
  name     = "tstvk-rg"
  location = "westus2"
}

resource "azurerm_kubernetes_cluster" "aks" {
  name                = "vkAKSCluster"
  location            = azurerm_resource_group.aks_rg.location
  resource_group_name = azurerm_resource_group.aks_rg.name
  dns_prefix          = "vkakscluster"

  default_node_pool {
    name       = "default"
    node_count = 1
    vm_size    = "Standard_DS2_v2"
    orchestrator_version = "1.27.9" # Set the Kubernetes version here
  }

  identity {
    type = "SystemAssigned"
  }
}

Deployment Succeded:

enter image description here

enter image description here