0

I am trying to deploy an AKS cluster using this terraform code.

resource "azurerm_kubernetes_cluster" "k8s" {
  name                = local.k8s.name
  location            = azurerm_resource_group.k8s_rg.location
  resource_group_name = azurerm_resource_group.k8s_rg.name
  dns_prefix          = local.k8s.dns_prefix

  default_node_pool {
    name       = "default"
    node_count = 1
    vm_size    = "Standard_D2_v2"
  }

  identity {
    type = "SystemAssigned"
  }

  tags = local.k8s.tags
}

And I am tired to search for a solution to this error message

azurerm_kubernetes_cluster.k8s: Creating... ╷ │ Error: creating Cluster: (Managed Cluster Name "assessment-cluster" / Resource Group "assessment"): containerservice.ManagedClustersClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="NoRegisteredProviderFound" Message="No registered resource provider found for location 'centralus' 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, 2024-02-01, 2024-02-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'." │ │ with azurerm_kubernetes_cluster.k8s, │ on aks.tf line 12, in resource "azurerm_kubernetes_cluster" "k8s": │ 12: resource "azurerm_kubernetes_cluster" "k8s" {

If you know what I am doing wrong, wow, that would be awesome. I don't know why I am facing this error message or where do I need to look at because the error message is not really helping at all.

1 Answer 1

1

The error "NoRegisteredProviderFound" indicates that the AKS resource provider is not registered for the specific location and API version you're using in your Terraform configuration. There are two possible solutions:

1. Use a Supported API Version:

  • The error message lists supported API versions for your chosen location (likely 'centralus' based on the code).
  • Check the supported versions and update the API version in your Terraform code if it's currently set to a preview version not available in your region.

2. Register the AKS Resource Provider:

  • If you specifically need to use a preview API version, you might need to register the AKS resource provider for your subscription.
  • Use the Azure CLI to register the provider with the following command:
az provider register --namespace Microsoft.ContainerService

Here are some additional tips:

  • Refer to the Azure documentation for details on supported locations and API versions for AKS: https://learn.microsoft.com/en-us/azure/aks/
  • Make sure you're using the latest version of the AzureRM Terraform provider, as newer versions might have better handling of API versions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .