Error: data helm repository doesn't work as expected

1/8/2020

I am trying to deploy the helm charts from ACR using the terraform-provider-helm but it fails with below error. Can someone please let me know if I am doing anything wrong because I am not able to understand why is this searching for mcpshareddcr-index.yaml ?

Terraform Version 0.12.18

Affected Resource(s) helm_release helm_repository

Terraform Configuration Files

# Cluster RBAC helm Chart repository
data "helm_repository" "cluster_rbac_helm_chart_repo" {
  name = "mcpshareddcr"
  url  = "https://mcpshareddcr.azurecr.io/helm/v1/repo"
  username = var.ARM_CLIENT_ID
  password = var.ARM_CLIENT_SECRET
}

# Deploy Cluster RBAC helm chart onto the cluster
resource "helm_release" "cluster_rbac_helm_chart_release" {
  name  = "mcp-rbac-cluster"
  repository = data.helm_repository.cluster_rbac_helm_chart_repo.metadata[0].name
  chart = "mcp-rbac-cluster"
  version = "0.1.0"
}
module usage:

provider "azurerm" {
  version                    = "=1.36.0"
  tenant_id                  = var.ARM_TENANT_ID
  subscription_id            = var.ARM_SUBSCRIPTION_ID
  client_id                  = var.ARM_CLIENT_ID
  client_secret              = var.ARM_CLIENT_SECRET
  skip_provider_registration = true
}

data "azurerm_kubernetes_cluster" "aks_cluster" {
  name                = var.aks_cluster
  resource_group_name = var.resource_group_aks
}

locals {
  kubeconfig_path = "/tmp/kubeconfig"
}

resource "local_file" "kubeconfig" {
  filename = local.kubeconfig_path
  content  = data.azurerm_kubernetes_cluster.aks_cluster.kube_admin_config_raw
}

provider "helm" {
  home = "./.helm"
  kubernetes {
    load_config_file = true
    config_path = local.kubeconfig_path
  }
}

// Module to deploy Stratus offered helmcharts in AKS cluster
module "mcp_resources" {
  source = "modules\/helm\/mcp-resources"
  ARM_CLIENT_ID = var.ARM_CLIENT_ID
  ARM_CLIENT_SECRET = var.ARM_CLIENT_SECRET
  ARM_SUBSCRIPTION_ID = var.ARM_SUBSCRIPTION_ID
  ARM_TENANT_ID = var.ARM_TENANT_ID
}

Expected Behavior Deploy of helm charts on AKS fetching from ACR.

Actual Behavior Error: Looks like "***/helm/v1/repo" is not a valid chart repository or cannot be reached: open .helm/repository/cache/.helm/repository/cache/mcpshareddcr-index.yaml: no such file or directory

Steps to Reproduce terraform plan

-- user3616775
azure-container-registry
azure-kubernetes
kubernetes-helm
terraform

0 Answers