Facing issue while accessing AKS deployments using Helm via terraform

Hi all,

While getting the terraform plan for AKS deployment using Helm, we are getting “Unauthorized” error only for Helm. It is able to refresh the state for other azure resources.

Step 1:
data.vault_generic_secret.azure_spn_shs: Refreshing state… [id=secret/azure/spn/shs]
kubernetes_namespace.main: Refreshing state… [id=kured]
helm_release.main: Refreshing state… [id=kured]

Error: Kubernetes cluster unreachable: stat /tmp/core-shs-aks-euw1_kubeconfig: no such file or directory

ERRO[0031] 1 error occurred:

  • exit status 1

Here it tries to refresh the state for helm, but it gives cluster is unreachable as we haven’t set the Kubeconfig

Step 2:
After applying the kubeconfig successfully, we are getting “Unauthorized” error

data.vault_generic_secret.azure_spn_shs: Refreshing state… [id=secret/azure/spn/shs]
kubernetes_namespace.main: Refreshing state… [id=kured]

Error: Unauthorized

ERRO[0012] 1 error occurred:

  • exit status 1

Here we are not getting the follwong line
helm_release.main: Refreshing state… [id=kured]

We have not made any changes recently but still we are facing this issue.

These versions we are using
Terraform v0.13.4
hashicorp/helm v2.17.0

Please provide support to fix this issue.