sl1pm4t / k2tf

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

Can't convert #77

Closed andir closed 2 years ago

andir commented 3 years ago

I was trying to convert the metrics-server YAML (https://github.com/kubernetes-sigs/metrics-server/tree/v0.4.2) to terraform code. While doing so k2tf produced a valid looking TF file but produced one resource with an invalid resource name (resource "kubernetes_api_service" "v_1_beta_1__metrics_k_8_s.io" { … }) due to it containing a .io at the end of the name. The dot is apparently not permitted in TF resource names.

The YAMl (sub) document leading to this is this:

  apiVersion: apiregistration.k8s.io/v1
  kind: APIService
  metadata:                      
    labels:                                                   
      k8s-app: metrics-server                                
    name: v1beta1.metrics.k8s.io                             
  spec:                                       
    group: metrics.k8s.io
    groupPriorityMinimum: 100
    insecureSkipTLSVerify: true
    service:      
      name: metrics-server
      namespace: kube-system
    version: v1beta1
    versionPriority: 100

Manually fixing the terraform resource name up did solve the issue but I think there is still a bug within k2tf somewhere.

sl1pm4t commented 2 years ago

I think this is fixed in #101