crossplane-contrib/terraform-provider-gen

decode.go generation does not work for slice types

Closed this issue · 1 comments

kasey commented
go generate ./...
angryjet: error: error loading packages using pattern ./...: /Users/kasey/src/crossplane-contrib/provider-terraform-vsphere/generated/resources/host_port_group/v1alpha1/decode.go:165:20: cannot range over p (variable of type *[]Ports)
exit status 1
generated/generate.go:29: running "go": exit status 1

This was one of the cases marked as a TODO from the version of the generator demo'd at community day. The current state of this particular case is basically copy/paste from encode, so this task entails reversing the logic.

kasey commented

After fixing this and trying to generate a few other types, I saw that a similar leftover bug exists for "singleton" collection types -- in some places terraform uses single item lists/sets to represent singletons. I'm not going to open a separate bug for this because I think I've already fixed it and it's sort of similar, although in a different part of the code.