terraform-provider-cloudflare: Cloudflare Load Balancer (and Pool) examples are not working

This issue was originally opened by @abacao as hashicorp/terraform#17948. It was migrated here as a result of the provider split. The original body of the issue is below.


I’m able to set all the DNS entries just fine but when I’m trying to provision the Load Balancer as shown in the examples pages: https://www.terraform.io/docs/providers/cloudflare/r/load_balancer.html and https://www.terraform.io/docs/providers/cloudflare/r/load_balancer_pool.html

What I get is this:

  • cloudflare_load_balancer_pool.foo: 1 error(s) occurred:
  • cloudflare_load_balancer_pool.foo: error creating load balancer pool: error from makeRequest: HTTP status 400: content “{\n "result": null,\n "success": false,\n "errors": [\n {\n "code": 1002,\n "message": "the origin list length must be in range [1, 0]: validation failed"\n }\n ],\n "messages": []\n}\n”

From the example, I have only changed the zone name to correspond my own. The output message is not helping me to figure it out either.

the complete tf file is this: ` resource “cloudflare_load_balancer” “bar” { zone = “example.com” name = “example-load-balancer” fallback_pool_id = “${cloudflare_load_balancer_pool.foo.id}” default_pool_ids = [“${cloudflare_load_balancer_pool.foo.id}”] description = “example load balancer using geo-balancing” proxied = true pop_pools { pop = “LAX” pool_ids = [“${cloudflare_load_balancer_pool.foo.id}”] } region_pools { region = “WNAM” pool_ids = [“${cloudflare_load_balancer_pool.foo.id}”] } }

resource “cloudflare_load_balancer_pool” “foo” { name = “example-lb-pool” origins { name = “example-1” address = “192.0.2.1” enabled = false } } `

PS - the terraform plan runs OK, it’s only when applying that the $*** hits the fan…

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 25 (9 by maintainers)

Most upvoted comments

I can verify that specifying org_id in the provider definition does fix errors like this.

If you are a member of an Organization or were invited to someone else’s account, please try adding one of these to provider section:

provider "cloudflare" {
  org_id = "xxx"
# or
  use_org_from_zone = "${var.cloudflare_domain}"
}

https://www.terraform.io/docs/providers/cloudflare/#org_id https://www.terraform.io/docs/providers/cloudflare/#use_org_from_zone

This indicates to me that this might be an issue with CloudFlare API(at least partially). I will do some tests tomorrow when I’m not drunk.

My misstep then- I had the exact same error until I went into the dashboard and clicked “Enable load balancers”. Obviously if you’ve already done this then it’s no help to you, but best of luck with your problem!