<p>I'm having issues getting the <a href="https://github.com/kubernetes/ingress-nginx" rel="nofollow noreferrer">ingress-nginx</a> Helm Chart to install via Terraform with Minikube, yet I'm able to install it successfully via the command line. Here is my vanilla Terraform code -</p>
<pre><code>provider &quot;kubernetes&quot; {
  host                   = &quot;https://127.0.0.1:63191&quot;
  client_certificate     = base64decode(var.client_certificate)
  client_key             = base64decode(var.client_key)
  cluster_ca_certificate = base64decode(var.cluster_ca_certificate)
}

provider &quot;helm&quot; {
  kubernetes {

  }
}

resource &quot;helm_release&quot; &quot;nginx&quot; {
  name        = &quot;beta-nginx&quot;
  repository  = &quot;https://kubernetes.github.io/ingress-nginx&quot;
  chart       = &quot;ingress-nginx&quot;
  namespace   = &quot;default&quot;
}
</code></pre>
<p>I get the following logs when I apply the Terraform code above -</p>
<pre><code>helm_release.nginx: Still creating... [4m31s elapsed]
2022-01-26T14:32:49.623-0600 [TRACE] dag/walk: vertex &quot;root&quot; is waiting for &quot;provider[\&quot;registry.terraform.io/hashicorp/helm\&quot;] (close)&quot;
2022-01-26T14:32:49.624-0600 [TRACE] dag/walk: vertex &quot;meta.count-boundary (EachMode fixup)&quot; is waiting for &quot;helm_release.nginx&quot;
2022-01-26T14:32:49.624-0600 [TRACE] dag/walk: vertex &quot;provider[\&quot;registry.terraform.io/hashicorp/helm\&quot;] (close)&quot; is waiting for &quot;helm_release.nginx&quot;
2022-01-26T14:32:51.299-0600 [INFO]  provider.terraform-provider-helm_v2.4.1_x5: 2022/01/26 14:32:51 [DEBUG] Service does not have load balancer ingress IP address: default/beta-nginx-ingress-nginx-controller: timestamp=2022-01-26T14:32:51.299-0600
2022-01-26T14:32:53.302-0600 [INFO]  provider.terraform-provider-helm_v2.4.1_x5: 2022/01/26 14:32:53 [DEBUG] Service does not have load balancer ingress IP address: default/beta-nginx-ingress-nginx-controller: timestamp=2022-01-26T14:32:53.302-0600
2022-01-26T14:32:54.626-0600 [TRACE] dag/walk: vertex &quot;provider[\&quot;registry.terraform.io/hashicorp/helm\&quot;] (close)&quot; is waiting for &quot;helm_release.nginx&quot;

Warning: Helm release &quot;beta-nginx&quot; was created but has a failed status. Use the `helm` command to investigate the error, correct it, then run Terraform again.

  with helm_release.nginx,
  on main.tf line 21, in resource &quot;helm_release&quot; &quot;nginx&quot;:
  21: resource &quot;helm_release&quot; &quot;nginx&quot; {


Error: timed out waiting for the condition

  with helm_release.nginx,
  on main.tf line 21, in resource &quot;helm_release&quot; &quot;nginx&quot;:
  21: resource &quot;helm_release&quot; &quot;nginx&quot; {
</code></pre>
<hr />
<p>When I try installing the Helm Chart via the command line <code>helm install beta-nginx ingress-nginx/ingress-nginx</code> it installs the chart no problem.</p>
<p>Here are a few version numbers:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Terraform</td>
<td>1.0.5</td>
</tr>
<tr>
<td>Minikube</td>
<td>1.25.1</td>
</tr>
<tr>
<td>Kubernetes</td>
<td>1.21.7</td>
</tr>
<tr>
<td>Helm</td>
<td>3.7.2</td>
</tr>
</tbody>
</table>
</div>
<p>This is because Terraform waits for LoadBalancer to get a public IP address, but this never happens, so the <code>Error: timed out waiting for the condition</code> error occurs:</p>
<pre><code>$ kubectl get svc
NAME                                            TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
beta-nginx-ingress-nginx-controller             LoadBalancer   &lt;PRIVATE_IP&gt;    &lt;pending&gt;     80:30579/TCP,443:30909/TCP   7m32s
</code></pre>
<p>You can install <a href="https://metallb.universe.tf/" rel="nofollow noreferrer">MetalLB</a> to get a load-balancer implementation or create a NodePort instead of LoadBalancer. I'll briefly demonstrate the second option.</p>
<p>All you have to do is modify the <a href="https://github.com/kubernetes/ingress-nginx/blob/c1be3499eb98756af4d2f5a5d165e6ff11cceeb5/charts/ingress-nginx/values.yaml#L501" rel="nofollow noreferrer"><code>controller.service.type</code></a> value from the <a href="https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml" rel="nofollow noreferrer">values.yaml</a> file:</p>
<pre><code>$ cat beta-nginx.tf 
provider &quot;helm&quot; {
  kubernetes {
    config_path = &quot;~/.kube/config&quot;
  }
}

resource &quot;helm_release&quot; &quot;nginx&quot; {
  name        = &quot;beta-nginx&quot;
  repository  = &quot;https://kubernetes.github.io/ingress-nginx&quot;
  chart       = &quot;ingress-nginx&quot;
  namespace   = &quot;default&quot;
  set {
    name  = &quot;controller.service.type&quot;
    value = &quot;NodePort&quot;
  }
}


$ terraform apply
...
      + set {
          + name  = &quot;controller.service.type&quot;
          + value = &quot;NodePort&quot;
        }
...
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

$ kubectl get svc
NAME                                            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
beta-nginx-ingress-nginx-controller             NodePort    &lt;PRIVATE_IP&gt;     &lt;none&gt;        80:32410/TCP,443:31630/TCP   74s
</code></pre>
<p>As you can see above, the NodePort service has been created instead of the LoadBalancer.</p>
