sl1pm4t / k2tf

Kubernetes YAML to Terraform HCL converter
Mozilla Public License 2.0
1.18k stars 108 forks source link

error while using the .tf file #93

Open Manoj-07 opened 2 years ago

Manoj-07 commented 2 years ago

I had successfully converted YAML to.tf while I am trying to deploy it I am getting the following error could you please help me to resolve the eeror image

kahara commented 2 years ago

Could you post those .yaml and .tf files?

Tip: copypasting text instead of images makes everything better.

Manoj-07 commented 2 years ago

https://github.com/Kurento/Kubernetes/blob/master/nginx-deployment-service.yaml nginx-deployment-service.yaml anfd the terraform converted file is

resource "kubernetes_deployment" "nginx" {
  metadata {
    name = "nginx"
  }

  spec {
    replicas = 3

    selector {
      match_labels = {
        app = "nginx"
      }
    }

    template {
      metadata {
        labels = {
          app = "nginx"
        }
      }

      spec {
        container {
          name  = "nginx"
          image = "nginx"

          port {
            container_port = 80
          }
        }
      }
    }

    strategy {
      type = "Recreate"
    }
  }
}

resource "kubernetes_service" "nginx" {
  metadata {
    name      = "nginx"
    namespace = "default"

    labels = {
      app = "nginx"
    }

    annotations = {
      "service.beta.kubernetes.io/aws-load-balancer-type" = "nlb"
    }
  }

  spec {
    port {
      name        = "http"
      protocol    = "TCP"
      port        = 80
      target_port = "80"
    }

    selector = {
      app = "nginx"
    }

    type                    = "LoadBalancer"
    external_traffic_policy = "Local"
  }
}