Skip to content
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

Multi worker_script requires settings org_id even for non organizational/enterprise accounts #387

Closed
perosb opened this issue Jun 20, 2019 · 5 comments

Comments

@perosb
Copy link

perosb commented Jun 20, 2019

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

@perosb perosb changed the title worker_script doesnt work with multi-script for non enterprise accounts worker_script doesn't work with multi-script for non enterprise accounts Jun 20, 2019
@jacobbednarz
Copy link
Member

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.

@perosb
Copy link
Author

perosb commented Jun 21, 2019

Thanks @jacobbednarz!
Setting org_id worked perfectly.

@perosb perosb changed the title worker_script doesn't work with multi-script for non enterprise accounts Multi worker_script requires settings org_id even for non organizational/enterprise accounts Jun 21, 2019
@AClarkie
Copy link

Where does org_id go?

@perosb
Copy link
Author

perosb commented Sep 24, 2019

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

In the provider config.

@jacobbednarz
Copy link
Member

@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).

patryk added a commit that referenced this issue Sep 27, 2019
* SDK-81: Refactor Workers resources to remove single-script code.
Closes #470
Closes #387
@patryk patryk closed this as completed in 0995af4 Sep 30, 2019
boekkooi-lengoo pushed a commit to boekkooi-lengoo/terraform-provider-cloudflare that referenced this issue Feb 28, 2022
* Fix unmarshalling of OriginCACertificate

* Linter and test fixes

* Use aliasing to override just a single field for unmarshalling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants