terraform {
required_providers {
kubernetes = {
source = “hashicorp/kubernetes”
version = “>= 2.0.3”
}
azurerm = {
source = “hashicorp/azurerm”
version = “=3.0.0”
}
}
}
provider “azurerm” {
features {
}
subscription_id = “”
tenant_id = “”
client_secret = “”
client_id = “”
}
data “azurerm_kubernetes_cluster” “default” {
name = “test-aks”
resource_group_name = “rg-test-aks”
}
provider “kubernetes” {
host = data.azurerm_kubernetes_cluster.default.kube_admin_config.0.host
client_certificate = base64decode(data.azurerm_kubernetes_cluster.default.kube_admin_config.0.client_certificate)
client_key = base64decode(data.azurerm_kubernetes_cluster.default.kube_admin_config.0.client_key)
cluster_ca_certificate = base64decode(data.azurerm_kubernetes_cluster.default.kube_admin_config.0.cluster_ca_certificate)
}
I configured main.tf as above and registered the appropriate azure credential, but client_key and client_certificate appear as null values in the tfstate file. Why is that? The aks version uses version 1.26.
To use the Kubernetes provider, I must have client_key and client_certificate.
Is there a way to obtain client_key and client_certificate when using aks version 1.26 or higher?