Closed rafaelmagu closed 4 years ago
Latest release (0.2.8) crashes when attempting to convert the following YAML:
apiVersion: v1 kind: Service metadata: name: echoheaders namespace: platform labels: app: echoheaders spec: type: NodePort ports: - port: 80 targetPort: 8080 protocol: TCP name: http selector: app: echoheaders --- apiVersion: v1 kind: ReplicationController metadata: name: echoheaders namespace: platform spec: replicas: 1 template: metadata: labels: app: echoheaders spec: containers: - name: echoheaders image: k8s.gcr.io/echoserver:1.10 ports: - containerPort: 8080
resource "kubernetes_service" "echoheaders" { metadata { name = "echoheaders" namespace = "platform" labels = { app = "echoheaders" } } spec { port { name = "http" protocol = "TCP" port = 80 target_port = "8080" } selector = { app = "echoheaders" } type = "NodePort" } } panic: must not call MapVal with empty map goroutine 1 [running]: github.com/zclconf/go-cty/cty.MapVal(0xc0002ce030, 0x27d9201, 0x14, 0xc0007896c0, 0x1) /go/pkg/mod/github.com/zclconf/go-cty@v1.0.1-0.20190708163926-19588f92a98f/cty/value_init.go:198 +0x556 main.(*ObjectWalker).closeBlock(0xc0000fe0b0, 0x0) /drone/src/hcl_writer.go:219 +0x160 main.(*ObjectWalker).Exit(0xc0000fe0b0, 0x1, 0x195, 0x3b7e6b0) /drone/src/hcl_writer.go:253 +0x48 github.com/mitchellh/reflectwalk.walkMap(0x256c800, 0xc000132118, 0x195, 0x2788a20, 0xc0000fe0b0, 0x0, 0x2544ee5) /go/pkg/mod/github.com/mitchellh/reflectwalk@v1.0.0/reflectwalk.go:243 +0x361 github.com/mitchellh/reflectwalk.walk(0x256c800, 0xc000132118, 0x195, 0x2788a20, 0xc0000fe0b0, 0x2bdb401, 0x256c800) /go/pkg/mod/github.com/mitchellh/reflectwalk@v1.0.0/reflectwalk.go:182 +0x4cb github.com/mitchellh/reflectwalk.walkStruct(0x26bd180, 0xc000132108, 0x199, 0x2788a20, 0xc0000fe0b0, 0x0, 0x24cb961) /go/pkg/mod/github.com/mitchellh/reflectwalk@v1.0.0/reflectwalk.go:385 +0x3d5 github.com/mitchellh/reflectwalk.walk(0x26bd180, 0xc000132108, 0x199, 0x2788a20, 0xc0000fe0b0, 0x2bdb401, 0x26bd180) /go/pkg/mod/github.com/mitchellh/reflectwalk@v1.0.0/reflectwalk.go:188 +0x571 github.com/mitchellh/reflectwalk.walkStruct(0x26bd0a0, 0xc000132000, 0x199, 0x2788a20, 0xc0000fe0b0, 0x100, 0xc000593200) /go/pkg/mod/github.com/mitchellh/reflectwalk@v1.0.0/reflectwalk.go:385 +0x3d5 github.com/mitchellh/reflectwalk.walk(0x27a9d40, 0xc000132000, 0x16, 0x2788a20, 0xc0000fe0b0, 0x23d3b01, 0x2757c40) /go/pkg/mod/github.com/mitchellh/reflectwalk@v1.0.0/reflectwalk.go:188 +0x571 github.com/mitchellh/reflectwalk.Walk(0x27a9d40, 0xc000132000, 0x2788a20, 0xc0000fe0b0, 0x0, 0x0) /go/pkg/mod/github.com/mitchellh/reflectwalk@v1.0.0/reflectwalk.go:92 +0x182 main.WriteObject(0x2b6afc0, 0xc000132000, 0xc000023860, 0x0, 0x0, 0x1) /drone/src/hcl_writer.go:30 +0x89 main.main() /drone/src/main.go:62 +0x2b6
Thanks for the details, I think I can see what's causing this issue.
Latest release (0.2.8) crashes when attempting to convert the following YAML:
Output