Terraform-provider-cloudflare: Multi worker_script requires settings org_id even for non organizational/enterprise accounts

Created on 20 Jun 2019  路  5Comments  路  Source: cloudflare/terraform-provider-cloudflare

Cloudflare launched multi script support for non enterprise accounts some week ago.
It's not possible to create a multiscript for non enterprise accounts using terraform plugin.

Terraform Version

2:29 $ terraform -v
Terraform v0.12.2

  • provider.cloudflare (v1.16.0)

Affected Resource(s)

Please list the resources as a list, for example:

  • cloudflare_worker_script
  • cloudflare_worker_route (?)

Debug Output

module.maps.cloudflare_worker_script.script: Creating...

Error: error creating worker script: organization ID required for enterprise only request

  on terraform-modules/worker/script.tf line 6, in resource "cloudflare_worker_script" "script":
   6: resource "cloudflare_worker_script" "script" {

resource (module):

resource "cloudflare_worker_script" "script" {
  name    = "${var.name}"
  content = file("dist/${var.name}.js")
}
resource "cloudflare_worker_route" "script-route" {
  zone       = "${var.zone}"
  pattern    = "${var.pattern}"
  enabled    = var.enabled
  depends_on = [cloudflare_worker_script.script]
}

Expected Behavior

scripts and routes should have been created

Actual Behavior

nothing is created.

possibly issue in cloudflare-go? https://github.com/cloudflare/cloudflare-go/blob/cf0705549ebf3ec9123c27b1f9e64af7b93eb08b/workers.go#L94

https://blog.cloudflare.com/just-write-code-improving-developer-experience-for-cloudflare-workers/#multiscript-for-all

Most helpful comment

Thanks for reporting this @perosb! Have you tried setting org_id equal to your account ID in the Terraform configuration? It's not ideal but it might work for now.

It will be great to generalise this functionality to not be Enterprise specific now as that was a bit of a headache to iron out.

All 5 comments

Thanks for reporting this @perosb! Have you tried setting org_id equal to your account ID in the Terraform configuration? It's not ideal but it might work for now.

It will be great to generalise this functionality to not be Enterprise specific now as that was a bit of a headache to iron out.

Thanks @jacobbednarz!
Setting org_id worked perfectly.

Where does org_id go?

provider "cloudflare" { org_id = "<the id>" }

In the provider config.

@perosb #478 is generalising this functionality so you no longer need the org_id work around and will be released with 2.0 (along with some other breaking changes).

Was this page helpful?
0 / 5 - 0 ratings