jrhouston / tfk8s

A tool for converting Kubernetes YAML manifests to Terraform HCL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic: not a string, manifest caused tfk8s to crash

ahmedatgithub opened this issue · comments

tfk8s -f values.yaml -o jk
panic: not a string

goroutine 1 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x65
main.capturePanic()
github.com/jrhouston/tfk8s/tfk8s.go:234 +0x39
panic({0x57a400, 0x5e60e8})
runtime/panic.go:884 +0x212
github.com/zclconf/go-cty/cty.Value.AsString({{{0x0?, 0x0?}}, {0x0?, 0x0?}})
github.com/zclconf/go-cty@v1.8.0/cty/value_ops.go:1251 +0x138
main.yamlToHCL({{{0x5e7768?, 0xc00010ed10?}}, {0x5815a0?, 0xc0001146f0?}}, {0x0, 0x0}, 0x0, 0x0, 0x0?)
github.com/jrhouston/tfk8s/tfk8s.go:103 +0x11f
main.YAMLToTerraformResources({0x5e6b68?, 0xc0000a2690?}, {0x0, 0x0}, 0x0?, 0x0?, 0x0?)
github.com/jrhouston/tfk8s/tfk8s.go:209 +0x2c8
main.main()
github.com/jrhouston/tfk8s/tfk8s.go:267 +0x36d

⚠️ Oh no! Looks like your manifest caused tfk8s to crash.

Please open a GitHub issue and include your manifest YAML with the stack trace above,
or ping me on slack and I'll try and fix it!

GitHub: https://github.com/jrhouston/tfk8s/issues
Slack: #terraform-providers on https://kubernetes.slack.com

here is the content of values.yaml:

fullnameOverride: prometheus
namespaceOverride: monitoring
operator:
  serviceAccount:
    create: true
    name: "prometheus-operator"
  namespaces: "monitoring"

prometheus:
  enabled: true
  serviceAccount:
    create: true
    name: "monitoring"
  service:
    annotations:
      external-dns.alpha.kubernetes.io/hostname: "prometheus.example.com"

  serviceMonitorNamespaceSelector:
    matchlabels:
      monitoring: prometheus

Hi @ahmedatgithub thanks for opening this. This tool is only for converting k8s manifests to terraform config – you're trying to convert a Helm values file. If you want to convert that to HCL you can try this:

echo 'yamldecode(file("values.yaml"))' | terraform console