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

Unsupported block type for r2_bucket_binding #4886

Open
irvinebroque opened this issue Jan 14, 2025 · 3 comments
Open

Unsupported block type for r2_bucket_binding #4886

irvinebroque opened this issue Jan 14, 2025 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@irvinebroque
Copy link

irvinebroque commented Jan 14, 2025

Terraform and Cloudflare provider version

terraform -v
Terraform v1.5.7
terraform {
  required_providers {
    cloudflare = {
      source = "cloudflare/cloudflare"
      version = "5.0.0-rc1"
    }
  }
}

r2_bucket_binding is defined here:

https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/internal/sdkv2provider/schema_cloudflare_workers_script.go#L262

We tell you to do this in the example:

  r2_bucket_binding {
    name        = "MY_BUCKET"
    bucket_name = "MY_BUCKET_NAME"
  }

https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/docs/resources/worker_script.md

Run terraform plan and observe:

➜  terraform-test git:(main) ✗ terraform plan
╷
│ Error: Unsupported block type
│
│   on cloudflare.tf line 23, in resource "cloudflare_workers_script" "terraform-test":
│   23:   r2_bucket_binding {
│
│ Blocks of type "r2_bucket_binding" are not expected here.

Affected resource(s)

R2 + Workers

Terraform configuration files

terraform {
  required_providers {
    cloudflare = {
      source = "cloudflare/cloudflare"
      version = "5.0.0-rc1"
    }
  }
}

resource "cloudflare_workers_script" "terraform-test" {
  account_id = "ID"
  content    = file("./src/index.js")
  script_name = "terraform-test"

  r2_bucket_binding {
    name        = "MY_BUCKET"
    bucket_name = "MY_BUCKET_NAME"
  }
}
@irvinebroque irvinebroque added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 14, 2025
Copy link
Contributor

Thank you for reporting this issue! For maintainers to dig into issues it is required that all issues include the entirety of TF_LOG=DEBUG output to be provided. The only parts that should be redacted are your user credentials in the X-Auth-Key, X-Auth-Email and Authorization HTTP headers. Details such as zone or account identifiers are not considered sensitive but can be redacted if you are very cautious. This log file provides additional context from Terraform, the provider and the Cloudflare API that helps in debugging issues. Without it, maintainers are very limited in what they can do and may hamper diagnosis efforts.

This issue has been marked with triage/needs-information and is unlikely to receive maintainer attention until the log file is provided making this a complete bug report.

@github-actions github-actions bot added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 14, 2025
Copy link
Contributor

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@jacobbednarz
Copy link
Member

looks like you're using 5.0.0-rc1 but referencing the 4.x branch. for 5.x, the bindings are a list of objects. we have an example at https://github.com/cloudflare/terraform-provider-cloudflare/blob/next/internal/services/workers_script/testdata/module.tf#L21-L32 and the schema lives at https://github.com/cloudflare/terraform-provider-cloudflare/blob/next/internal/services/workers_script/schema.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants