Azure AKS with agic - how to create it with Terraform?

4/14/2020

I'm currently setting up an AGIC (Kubernetes Application Gateway Ingress Controller) for an AKS environment (https://azure.github.io/application-gateway-kubernetes-ingress/setup/install-existing/#using-a-service-principal).

As the whole environment is setup with Terraform, I'd like to install the necessary Helm repository also with Terraform.

Thought, the following simple code should do the trick:

data "helm_repository" "agic_repo" {
 name      = "agic_repository"
 url       = "https://appgwingress.blob.core.windows.net/ingress-azure-helm-package/"
}

resource "helm_release" "agic" {
 name        = "agic"
 namespace   = "agic"
 repository  = data.helm_repository.agic_repo.metadata[0].url
 chart       = "application-gateway-kubernetes-ingress"

 depends_on = [
    data.helm_repository.agic_repo,
  ]
}

But I ran into this issue:

module.agic.helm_release.agic: Creating...



Error: chart "application-gateway-kubernetes-ingress" not found in https://appgwingress.blob.core.windows.net/ingress-azure-helm-package/ repository



  on ../../modules/agic/main.tf line 91, in resource "helm_release" "agic":

  91: resource "helm_release" "agic" {

So it looks, as if the package cannot be found. Did anyone else solve this before?

I'm not familiar with Helm, so I don't know how to 'browse' within the Helm repos to check whether I'm addressing the right URI...

So I added the repo manually with

helm repo add application-gateway-kubernetes-ingress https://appgwingress.blob.core.windows.net/ingress-azure-helm-package/

When I search for the repo I receive:

V5T:~$ helm search | grep ingress
application-gateway-kubernetes-ingress/ingress-azure    1.0.0           1.0.0                   Use Azure Application Gateway as the ingress for an Azure...

Any help appreciated!

P.S.: Sure, I could do it with a bash one-liner, but would be great to have the whole environment created by Terraform...

-- MaxiPalle
azure
kubernetes
kubernetes-helm
terraform
terraform-provider-azure

1 Answer

4/14/2020

According to the data you provided it has to be this:

resource "helm_release" "agic" {
 name        = "agic"
 namespace   = "agic"
 repository  = data.helm_repository.agic_repo.metadata[0].url
 chart       = "ingress-azure"

 depends_on = [
    data.helm_repository.agic_repo,
  ]
}

so the chart name is different

-- 4c74356b41
Source: StackOverflow