-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic while running cf-terraforming generate for access application #707
Comments
Getting the same error when trying to import
|
@jacobbednarz could you please take a look?😇 |
I'm also seeing the same problem, looks like I can import other resource types ok but I get the same error when trying to extract out an existing application I've got configured in Cloudflare with the same panic error - interface {} is float64, not string. I'm no golang expert but I've taken a quick look at the code and it looks like it's using a generic map to write the values out to keep the code simple, but I'm assuming it's the JSON unmarshalling that's flipping a value to the float64. Not sure if I can easily hack a fix for it but looking at internal/app/cf-terraforming/cmd/util.go on line 228 I think: A proper fix might involve more changes to the response handler when it receives data from the API to populate structs or something similar depending on the type of object being queried. I'll let you know if I manage to find a quick hack for this if the repo owner can't find a proper fix before me, but as mentioned, I'm no golang expert! |
I've been able to get it a little bit further, but I'm hitting further issues unfortunately. I've got the code to be able to handle different variable types now however when querying for the "cloudflare_access_application" resource type, I start seeing nested arrays in the response which means an additional layer of handling is required. Not sure what to suggest at this stage, as I'd need to understand the API a little more and the code itself to work out how best to handle the different responses, and I've not got very much spare time on my hands right now, sorry! |
I'm not part of the project team, but I had a similar error. It was because I had updated cf-terraforming, but hadn't switched to a newer version of the terraform provider. i.e. I needed to update to version 4 in my cloudflare.tf:
|
Updated to the latest cf-terraforming (0.21.0) + the latest stable cloudflare terraform provider (4.48.0) and now get a similar error message: panic: interface conversion: interface {} is []interface {}, not string
goroutine 1 [running]:
github.com/cloudflare/cf-terraforming/internal/app/cf-terraforming/cmd.writeAttrLine({0x140006813f8, 0x8}, {0x1047b20e0, 0x1400043aeb8}, {0x0?, 0x1047bcda0?}, 0x1400043abe8)
internal/app/cf-terraforming/cmd/util.go:228 +0xbb0
github.com/cloudflare/cf-terraforming/internal/app/cf-terraforming/cmd.writeAttrLine({0x140006813f8, 0x8}, {0x1047b5580, 0x1400043a738}, {0x0, 0x0}, 0x1400043abe8)
internal/app/cf-terraforming/cmd/util.go:275 +0x1200
github.com/cloudflare/cf-terraforming/internal/app/cf-terraforming/cmd.init.generateResources.func2(0x104d0bda0, {0x10463aad7?, 0x4?, 0x10463aa5b?})
internal/app/cf-terraforming/cmd/generate.go:1406 +0x5614
github.com/spf13/cobra.(*Command).execute(0x104d0bda0, {0x140000b9880, 0x4, 0x4})
/Users/sebastian/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:989 +0x81c
github.com/spf13/cobra.(*Command).ExecuteC(0x104d0c360)
/Users/sebastian/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
/Users/sebastian/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/cloudflare/cf-terraforming/internal/app/cf-terraforming/cmd.Execute()
internal/app/cf-terraforming/cmd/root.go:30 +0x24
main.main()
cmd/cf-terraforming/main.go:8 +0x1c |
Confirmation
cf-terraforming version
cf-terraforming 0.20.0
Expected outcome
cf-terraforming generate --zone <zone_id> --resource-type cloudflare_access_application
generates resource blocks for the applications in the zoneActual outcome
Steps to reproduce
brew install cloudflare/cloudflare/cf-terraforming
should upgrade to v0.20.0References
No response
The text was updated successfully, but these errors were encountered: