Error when creating deployment through terraform

Hello All ,

i am trying to create a simple deployment using Azure kubernetes service and test the Horizontal Pod Autoscaling functionality through terraform. However i am getting the below error, can you guys suggest what am i missing here.

Error: Failed to create deployment: Post “http://localhost/apis/apps/v1/namespaces/default/deployments”: dial tcp [::1]:80: connectex: No connection could be made because the target machine actively refused it.

Below is the sample file i have used :

terraform {
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “=3.0.0”
}
}
}

resource “azurerm_resource_group” “example” {
name = “Test-RG”
location = “West Europe”
}
resource “azurerm_kubernetes_cluster” “example” {
name = “Azure-AKS”
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = “dnsprefix”

default_node_pool {
name = “default”
node_count = 1
vm_size = “Standard_D2_v2”
}

identity {
type = “SystemAssigned”
}

tags = {
Environment = “Production”
}
}

resource “kubernetes_deployment” “example” {
metadata {
name = “deployment”
labels = {
test = “MyExampleApp”
}
}

spec {
replicas = 1

selector {
  match_labels = {
    test = "MyExampleApp"
  }
}

template {
  metadata {
    labels = {
      test = "MyExampleApp"
    }
  }

  spec {
    container {
      image = "nginx:1.21.6"
      name  = "example"


      resources {
        limits = {
          cpu    = "0.5"
          memory = "512Mi"
        }
        requests = {
          cpu    = "250m"
          memory = "50Mi"
        }
      }

     /* liveness_probe {
        http_get {
          path = "/"
          port = 80
           
          http_header {
            name  = "X-Custom-Header"
            value = "Awesome"
          }
        }

        initial_delay_seconds = 3
        period_seconds        = 3
      }*/
    }
  }
}

}
}
resource “kubernetes_horizontal_pod_autoscaler” “example” {
metadata {
name = “binduhpa”
}

spec {
max_replicas = 4
min_replicas = 2
target_cpu_utilization_percentage = 10

scale_target_ref {
  kind = "Deployment"
  name = "bindu-deployment"
}

}
}

output “client_certificate” {
value = azurerm_kubernetes_cluster.example.kube_config.0.client_certificate
sensitive = true
}

output “kube_config” {
value = azurerm_kubernetes_cluster.example.kube_config_raw
sensitive = true
}