The China colo request is throwing 500s:
$ curl -fsSL https://api.cloudflare.com/client/v4/ips?china_colo=1
curl: (22) The requested URL returned error: 500
It has been throwing 500s for about 45 minutes.
The regular IP list is not throwing 500s:
$ curl -fsSL https://api.cloudflare.com/client/v4/ips
{"result":{"ipv4_cidrs":["173.245.48.0\/20","103.21.244.0\/22","103.22.200.0\/22","103.31.4.0\/22","141.101.64.0\/18","108.162.192.0\/18","190.93.240.0\/20","
188.114.96.0\/20","197.234.240.0\/22","198.41.128.0\/17","162.158.0.0\/15","104.16.0.0\/13","104.24.0.0\/14","172.64.0.0\/13","131.0.72.0\/22"],"ipv6_cidrs":[
"2400:cb00::\/32","2606:4700::\/32","2803:f800::\/32","2405:b500::\/32","2405:8100::\/32","2a06:98c0::\/29","2c0f:f248::\/32"],"etag":"38f79d050aa027e3be3865e
495dcc9bc"},"success":true,"errors":[],"messages":[]}
I would like to request that in the future, rather than throwing errors, a best effort should be made to return the last successful results. We query these ranges to update security groups, and when the call fails, our automation to update security groups fails. We would rather not have to build in caching to our own solution, so if the API can handle that for us, that would be greatly appreciated.
This has also broken the Cloudflare Go library which has in turn broken the Terraform Cloudflare provider when using the cloudflare_ip_ranges data resource.
opened 03:18AM - 22 Dec 21 UTC
closed 03:44AM - 22 Dec 21 UTC
triage/unresolved
### Confirmation
- [X] My issue isn't already found on the issue tracker.
- … [X] I have replicated my issue using the latest version of the provider and it is still present.
### Terraform and Cloudflare provider version
Terraform v1.0.10
on linux_amd64
+ provider registry.terraform.io/cloudflare/cloudflare v3.5.0
### Affected resource(s)
The "cloudflare_ip_ranges" data resource per https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/data-sources/ip_ranges
### Terraform configuration files
```hcl
data "cloudflare_ip_ranges" "cloudflare" {
}
```
### Debug output
Sorry, most of my terraform plan contains sensitive info (even resource name) that for various reasons I can't provide.
This is all I get back regarding this resource
```
[...]
2021-12-22T14:11:16.062+1100 [DEBUG] ProviderTransformer: "data.cloudflare_ip_ranges.cloudflare" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
2021-12-22T14:11:16.111+1100 [DEBUG] ReferenceTransformer: "data.cloudflare_ip_ranges.cloudflare" references: []
[...]
2021-12-22T14:11:16.725+1100 [DEBUG] ProviderTransformer: "data.cloudflare_ip_ranges.cloudflare (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/cloudflare/cloudflare"]
[...]
2021-12-22T14:11:16.768+1100 [DEBUG] ReferenceTransformer: "data.cloudflare_ip_ranges.cloudflare (expand)" references: []
[...]
2021-12-22T14:11:17.158+1100 [DEBUG] ReferenceTransformer: "data.cloudflare_ip_ranges.cloudflare" references: []
[...]
2021-12-22T14:12:49.579+1100 [INFO] backend/local: plan operation completed
ESC[31m╷ESC[0mESC[0m
ESC[31m│ESC[0m ESC[0mESC[1mESC[31mError: ESC[0mESC[0mESC[1mfailed to fetch Cloudflare IP ranges: error unmarshalling the JSON response: unexpected end of JSON inputESC[0m
ESC[31m│ESC[0m ESC[0m
ESC[31m│ESC[0m ESC[0mESC[0m with data.cloudflare_ip_ranges.cloudflare,
ESC[31m│ESC[0m ESC[0m on do_firewalls.tf line 1, in data "cloudflare_ip_ranges" "cloudflare":
ESC[31m│ESC[0m ESC[0m 1: data "cloudflare_ip_ranges" "cloudflare" ESC[4m{ESC[0mESC[0m
ESC[31m│ESC[0m ESC[0m
ESC[31m╵ESC[0mESC[0m
2021-12-22T14:12:49.583+1100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-12-22T14:12:49.584+1100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/cloudflare/cloudflare/3.5.0/linux_amd64/terraform-provider-cloudflare_v3.5.0 pid=4051
2021-12-22T14:12:49.584+1100 [DEBUG] provider: plugin exited
```
### Panic output
_No response_
### Expected output
I expected it to not throw the below error :)
### Actual output
```
│ Error: failed to fetch Cloudflare IP ranges: error unmarshalling the JSON response: unexpected end of JSON input
│
│ with data.cloudflare_ip_ranges.cloudflare,
│ on do_firewalls.tf line 1, in data "cloudflare_ip_ranges" "cloudflare":
│ 1: data "cloudflare_ip_ranges" "cloudflare" {
```
### Steps to reproduce
Use this in your terraform somewhere
```
data "cloudflare_ip_ranges" "cloudflare" {
}
```
### Additional factoids
I noticed that https://www.cloudflare.com/ips-v4 and https://www.cloudflare.com/ips-v6 have no newline at the end after the last IP CIDR range. Wondered if that was tripping Terraform's json logic.
### References
_No response_
Thanks for the update @user15569 .
Hopefully one of the devs reads this eventually… I wonder if there’s an official way to report services being down?