sl1pm4t / k2tf

Kubernetes YAML to Terraform HCL converter
Mozilla Public License 2.0
1.19k stars 107 forks source link

Not importing Ingress TLS #21

Closed ajchiarello closed 5 years ago

ajchiarello commented 5 years ago

Importing a yaml for an Ingress with TLS gives the warning that is excluded for not being in the Terraform schema. Per the Terraform Kubernetes Ingress documentation, it is part of the schema (https://www.terraform.io/docs/providers/kubernetes/r/ingress.html#tls)

Steps to recreate -

Converting this yaml:

apiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: labels: app: mdid name: mdidnp namespace: mdid spec: rules:

  • host: mdid-np.example.com http: paths:
    • backend: serviceName: mdid-np servicePort: 8080 path: / tls:
  • secretName: mdid-np

Gives this response:

11:12AM Warn | excluding attribute [kubernetes_ingress.spec.tl] not found in Terraform schema field=Ingress.Spec.TLS name=mdidnp type=kubernetes_ingress resource "kubernetes_ingress" "mdidnp" { metadata { name = "mdidnp" namespace = "mdid"

labels {
  app = "mdid"
}

}

spec { rule { host = "mdid-np.example.com"

  http {
    path {
      path = "/"

      backend {
        service_name = "mdid-np"
        service_port = "8080"
      }
    }
  }
}

} } It should be: resource "kubernetes_ingress" "mdidnp" { metadata { name = "mdidnp" namespace = "mdid"

labels {
  app = "mdid"
}

}

spec { rule { host = "mdid-np.example.com"

  http {
    path {
      path = "/"

      backend {
        service_name = "mdid-np"
        service_port = "8080"
      }
    }
  }
}
tls {
  secret_name = "mdid-np"
}

} }

sl1pm4t commented 5 years ago

@ajchiarello Thanks for the info. I've merged a fix for this issue.

ajchiarello commented 5 years ago

@sl1pm4t Thanks. I think you have a similar issue with NFS persistent volumes (the error is pretty similar)

ezlo-eugenek commented 5 years ago

@sl1pm4t I have same issue with image_pull_secrets 5:19PM Warn | excluding attribute [kubernetes_deployment.spec.template.spec.image_pull_secret] not found in Terraform schema field=Deployment.Spec.Template.Spec.ImagePullSecrets