crossplane / upjet

A code generation framework and runtime for Crossplane providers
Apache License 2.0
318 stars 89 forks source link

Problem with name of resource with only provider name #396

Open littlejo opened 6 months ago

littlejo commented 6 months ago

What happened?

I'm trying to create crossplane provider using upjet for my provider: https://github.com/littlejo/terraform-provider-cilium I tried to export two resources: cilium and cilium_hubble But i can't export cilium:

17:22:32 [ .. ] go generate linux_amd64
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
[github.com/crossplane/upjet/pkg/config.DefaultResource({0xc000012eb8](http://github.com/crossplane/upjet/pkg/config.DefaultResource(%7B0xc000012eb8), 0x6}, 0xc0001feee0, 0xc0001e4bd0, {0xc00042c028, 0x1, 0x100f8fe?})
    /Users/joseph.ligier/go/pkg/mod/github.com/crossplane/upjet@v0.11.0-rc.0.0.20231012093706-c4a76d2a7505/pkg/config/common.go:66 +0x3cc
[github.com/crossplane/upjet/pkg/config.NewProvider({0xc0002a6000](http://github.com/crossplane/upjet/pkg/config.NewProvider(%7B0xc0002a6000)?, 0xc0005561e0?, 0xc00039fd78?}, {0x2503fc0, 0x6}, {0x2530837, 0x23}, {0xc0002a8000, 0x1bb8, 0x2000}, ...)
    /Users/joseph.ligier/go/pkg/mod/github.com/crossplane/upjet@v0.11.0-rc.0.0.20231012093706-c4a76d2a7505/pkg/config/provider.go:253 +0x76e
[github.com/littlejo/provider-cilium/config.GetProvider()](http://github.com/littlejo/provider-cilium/config.GetProvider())
    /Users/joseph.ligier/clients/perso/crossplane/provider-cilium/config/provider.go:29 +0x365
main.main()
    /Users/joseph.ligier/clients/perso/crossplane/provider-cilium/cmd/generator/main.go:26 +0x65
exit status 2
apis/generate.go:25: running “go”: exit status 1
17:23:35 [FAIL]
make[1]: *** [go.generate] Error 1
make: *** [generate] Error 2

How can we reproduce it?

Github: repo is https://github.com/littlejo/provider-cilium Branch: cilium-resource make generate