<p>I'm using minikube locally.
The following is the <code>.tf</code> file I use to create my kubernetes cluster:</p>
<pre><code>provider &quot;kubernetes&quot; {
  config_path = &quot;~/.kube/config&quot;
}

resource &quot;kubernetes_namespace&quot; &quot;tfs&quot; {
  metadata {
    name = &quot;tfs&quot; # terraform-sandbox
  }
}

resource &quot;kubernetes_deployment&quot; &quot;golang_webapp&quot; {
  metadata {
    name      = &quot;golang-webapp&quot;
    namespace = &quot;tfs&quot;
    labels = {
      app = &quot;webapp&quot;
    }
  }
  spec {
    replicas = 3
    selector {
      match_labels = {
        app = &quot;webapp&quot;
      }
    }
    template {
      metadata {
        labels = {
          app = &quot;webapp&quot;
        }
      }
      spec {
        container {
          image             = &quot;golang-docker-example&quot;
          name              = &quot;golang-webapp&quot;
          image_pull_policy = &quot;Never&quot; # this is set so that kuberenetes wont try to download the image but use the localy built one
          liveness_probe {
            http_get {
              path = &quot;/&quot;
              port = 8080
            }
            initial_delay_seconds = 15
            period_seconds        = 15
          }

          readiness_probe {
            http_get {
              path = &quot;/&quot;
              port = 8080
            }
            initial_delay_seconds = 3
            period_seconds        = 3
          }
        }
      }
    }
  }
}


resource &quot;kubernetes_service&quot; &quot;golang_webapp&quot; {
  metadata {
    name      = &quot;golang-webapp&quot;
    namespace = &quot;tfs&quot;
    labels = {
      app = &quot;webapp_ingress&quot;
    }
  }
  spec {
    selector = {
      app = kubernetes_deployment.golang_webapp.metadata.0.labels.app
    }
    port {
      port        = 8080
      target_port = 8080
      protocol    = &quot;TCP&quot;
    }
    # type = &quot;ClusterIP&quot;
    type = &quot;NodePort&quot;
  }
}

resource &quot;kubernetes_ingress&quot; &quot;main_ingress&quot; {
  metadata {
    name      = &quot;main-ingress&quot;
    namespace = &quot;tfs&quot;
  }

  spec {
    rule {
      http {
        path {
          backend {
            service_name = &quot;golang-webapp&quot;
            service_port = 8080
          }
          path = &quot;/golang-webapp&quot;
        }
      }
    }
  }
}

</code></pre>
<p>When executing <code>terraform apply</code>, I am successfully able to create all of the resources except for the ingress.</p>
<p>The error is:</p>
<pre><code>Error: Failed to create Ingress 'tfs/main-ingress' because: the server could not find the requested resource (post ingresses.extensions)

with kubernetes_ingress.main_ingress,
   on main.tf line 86, in resource &quot;kubernetes_ingress&quot; &quot;main_ingress&quot;:
   86: resource &quot;kubernetes_ingress&quot; &quot;main_ingress&quot; {
</code></pre>
<p>When I try to create an ingress service with kubectl using the same configuration as the one above (only in <code>.yaml</code> and using the <code>kubectl apply</code> command) it works, so it seems that kubectl &amp; minikube are able to create this type of ingress, but terraform cant for some reason...</p>
<p>Thanks in advance for any help!</p>
<p>Edit 1:</p>
<p>adding the <code>.yaml</code> that I'm able to create the ingress with</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  namespace: tfs
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: golang-webapp
                port:
                  number: 8080
</code></pre>

Max
<p>The <code>kubernetes_ingress</code> resource generate an ingress with an <code>apiVersion</code> which is not supported by your kubernetes cluster. You have to use <code>[kubernetes_ingress_v1][1]</code> resource which looks similar to <code>kubernetes_ingress</code> resource with some diferences. For your example, it will be like this :</p>
<pre><code>resource &quot;kubernetes_ingress_v1&quot; &quot;jenkins-ingress&quot; {
   metadata {
      name        = &quot;example-ingress&quot;
      namespace   = &quot;tfs&quot;
      annotations = {
        &quot;nginx.ingress.kubernetes.io/rewrite-target&quot; = &quot;/$1&quot;
      }
   }
   spec {
      rule {
        http {
         path {
           path = &quot;/&quot;
           backend {
             service {
               name = &quot;golang-webapp&quot;
               port {
                 number = 8080
               }
             }
           }
        }
      }
    }
  }
}
</code></pre>
