I'm setting up a one-click deploy of an environment for some webservices, in which Terraform is used to deploy the infrastructure and then run Helm to populate it. The Terraform step is working fine and I can see the Kubernetes cluster created in Azure, but the Helm deploy is failing.
I'm using the Hashicorp Helm provider, and the config in providers.tf
looks like this:
provider "helm" {
repository_config_path = "${path.module}/helm/repositories.yaml"
repository_cache = "${path.module}/helm"
kubernetes {
host = azurerm_kubernetes_cluster.k8s.kube_config[0].host
username = azurerm_kubernetes_cluster.k8s.kube_config[0].username
password = azurerm_kubernetes_cluster.k8s.kube_config[0].password
cluster_ca_certificate = base64decode(azurerm_kubernetes_cluster.k8s.kube_config[0].cluster_ca_certificate)
client_certificate = base64decode(azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate)
client_key = azurerm_kubernetes_cluster.k8s.kube_config[0].client_key
}
debug = true
}
The listed /helm/repositories.yaml
file just lets it access our own repositories of in-house Helm charts.
The actual deployment step is super basic, and looks like this:
resource "helm_release" "company-service" {
name = "company-service"
repository = "oci://company.azurecr.io/helm"
chart = "company-service"
}
where obviously company
is the name of our company and service
is the name of the webservice I want to deploy.
The precise error message is:
│ Error: Kubernetes cluster unreachable: tls: failed to find any PEM data in key input
│
│ with helm_release.company-service,
│ on main.tf line 29, in resource "helm_release" "company-service":
│ 29: resource "helm_release" "company-service" {
where line 29 is the line kubernetes {
from the providers.tf
block above.