Reputation: 21
terraform {
backend "azurerm" {
resource_group_name = "storage"
storage_account_name = "statefile"
container_name = "state"
key = "terraform_local.tfstate"
}
}
data "azurerm_client_config" "current" {}
provider "azurerm" {
features {}
}
# Create a resource group
resource "random_pet" "rg_name" {
prefix = var.resource_group_name_prefix
}
#create a resource group
resource "azurerm_resource_group" "rg" {
name = random_pet.rg_name.id
location = var.resource_group_location
}
resource "azurerm_kubernetes_cluster" "cluster" {
name = "learnk8scluster"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
dns_prefix = "learnk8scluster"
default_node_pool {
name = "default"
node_count = "2"
vm_size = "standard_d2_v2"
}
identity {
type = "SystemAssigned"
}
}
I'm attempting to create a simple AKS cluster within a resource group. However when I run terraform init, plan and apply I get the following:
Error: creating Kubernetes Cluster │ Resource Group Name: "rg-rational-monkfish" │ Kubernetes Cluster Name: "learnk8scluster": polling after CreateOrUpdate:
result.Status
was nil/empty -op.Status
was "ProvisionNetworkResources" /op.Properties.ProvisioningState
was ""
It's created in my azure portal, However it's not within the state file.
Upvotes: -1
Views: 63
Reputation: 2401
Unexpected behaviour while to creating AKS using terraform
This kind of provisioning issues are quit offen itseems due to a transient issue or a misconfiguration.
As per the terraform registry it is seems that
When i checked using eastus2
, centralus
, eastasia
, westcentralus
, uksouth
, eastus
location all able working fine from this morning.
When I checked i was able to provision the resource across different locations.
Demo configuration:
terraform {
backend "azurerm" {
resource_group_name = "vksb-rg"
storage_account_name = "fdadabhadkcajcjal"
container_name = "state"
key = "terraformlocal.tfstate"
}
}
data "azurerm_client_config" "current" {}
resource "azurerm_kubernetes_cluster" "cluster" {
name = var.aks_cluster_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
dns_prefix = var.aks_cluster_name
default_node_pool {
name = "default"
node_count = var.node_count
vm_size = var.vm_size
}
identity {
type = "SystemAssigned"
}
tags = {
environment = "test"
}
depends_on = [azurerm_resource_group.rg]
}
Deployment:
For more information on relevent issue go through the documentation mentioned below
Unable to create azurerm_kubernetes_cluster
· Issue #28878 · hashicorp/terraform-provider-azurerm
azurerm_kubernetes_cluster | Resources | hashicorp/azurerm | Terraform | Terraform Registry
Upvotes: 0