cf-terraforming icon indicating copy to clipboard operation
cf-terraforming copied to clipboard

cloudflare_zone_settings_override: panic: interface conversion: interface is nil, not interface {}

Open barbich opened this issue 2 years ago • 2 comments

Confirmation

  • [X] My issue isn't already found on the issue tracker.
  • [X] I have replicated my issue using the latest version of the library and it is still present.

cf-terraforming version

cf-terraforming v0.7.3

Expected outcome

hi I'm trying to retrieve the cloudflare_zone_settings_override . This used to work a couple of days ago with v0.7.3 (and v0.6..). Note that requesting other resource types is still OK.

Actual outcome

cloudflare$ ./cf-terraforming generate -v --resource-type cloudflare_zone_settings_override --zone f82f3fc005XXXXX DEBU[0000] initializing cloudflare-go with API Token account_Id= zone_id=f82f3fc005XXXXXX DEBU[0004] initializing Terraform in .
DEBU[0005] reading Terraform schema for Cloudflare provider DEBU[0005] beginning to read and build cloudflare_zone_settings_override resources cloudflare-go [DEBUG] REQUEST Method:GET URI:https://api.cloudflare.com/client/v4/zones/f82f3fc005XXXXX/settings Headers:http.Header(nil) Body: cloudflare-go [DEBUG] RESPONSE URI:https://api.cloudflare.com/client/v4 StatusCode:200 Body:"{"result":[{"id":"0rtt","value":"off","modified_on":null,"editable":true},{"id":"ad.....}" RayID:7071fb92fa99dxxx-BRU panic: interface conversion: interface is nil, not interface {}

goroutine 1 [running]: github.com/cloudflare/cf-terraforming/internal/app/cf-terraforming/cmd.generateResources.func1(0xd40ca0?, {0x9721f4?, 0x6?, 0x6?}) /home/runner/work/cf-terraforming/cf-terraforming/internal/app/cf-terraforming/cmd/generate.go:752 +0x6279 github.com/spf13/cobra.(*Command).execute(0xd40ca0, {0xc0000b4540, 0x6, 0x6}) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x663 github.com/spf13/cobra.(*Command).ExecuteC(0xd411a0) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3b4 github.com/spf13/cobra.(*Command).Execute(...) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:902 github.com/cloudflare/cf-terraforming/internal/app/cf-terraforming/cmd.Execute() /home/runner/work/cf-terraforming/cf-terraforming/internal/app/cf-terraforming/cmd/root.go:30 +0x25 main.main() /home/runner/work/cf-terraforming/cf-terraforming/cmd/cf-terraforming/main.go:8 +0x17 seb@seb-GB-BKi7:~/work/Office/ectl-itsec/Development/cloudflare$

Steps to reproduce

  1. ./cf-terraforming generate -v --resource-type cloudflare_zone_settings_override --zone f82f3fc005XXXXX

References

No response

barbich avatar May 06 '22 13:05 barbich

My suspicion is that this is due to the max_upload value. from the cloudflare terraform provider documentation and schema it is expected to be a INT: /cloudflare/terraform-provider-cloudflare/schema_cloudflare_zone_settings_override.go+449: "max_upload": { Type: schema.TypeInt, Optional: true, Computed: true, },

But the value can also be NULL for entreprise customer requesting non standard values (as is our case): { "result": [ ... { "id": "max_upload", "value": null, "modified_on": "2022-05-06T11:04:45.758088Z", "editable": true }, ... ], "success": true, "errors": [], "messages": [] }

barbich avatar May 06 '22 14:05 barbich

Hi I'm experiencing the same issue

istvanfedak avatar Jul 07 '22 15:07 istvanfedak