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

v5.0.0 cloudflare_list_item.comment "Cannot set value for this attribute as the provider has marked it as read-only" #5040

Open
3 tasks done
ambis opened this issue Feb 4, 2025 · 1 comment
Labels
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.

Comments

@ambis
Copy link

ambis commented Feb 4, 2025

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.10.5
on darwin_arm64

  • provider registry.terraform.io/cloudflare/cloudflare v5.0.0

Affected resource(s)

cloudflare_list_item

Terraform configuration files

resource "cloudflare_list" "list" {
  account_id  = var.cloudflare_account_id
  description = "My list"
  kind        = "ip"
  name        = "list"
}

resource "cloudflare_list_item" "item" {
  for_each = {
    "1.1.1.1" = "comment1"
    "8.8.8.8" = "comment2"
  }

  account_id = var.cloudflare_account_id
  list_id    = cloudflare_list.list.id

  ip = each.key
  comment = each.value
}

Link to debug output

cannot provide, simple enough to test with above snippet

Panic output

No response

Expected output

Plan/apply succeeds normally and updates the comment.

Actual output

│ Error: Invalid Configuration for Read-Only Attribute

│ with cloudflare_list_item.item,
│ on file.tf line 54, in resource "cloudflare_list_item" "item":
│ 54: comment = "comment1"

│ Cannot set value for this attribute as the provider has marked it as read-only. Remove the configuration line setting the value.

│ Refer to the provider documentation or contact the provider developers for additional information about configurable and read-only attributes that are supported.

Steps to reproduce

  1. Run TF like above

Additional factoids

The documentation is all over the place:
https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/list_item

It talks about a body {} element which is not documented in any way, nor can one use a body element:
│ Blocks of type "body" are not expected here.

References

No response

@ambis ambis 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 Feb 4, 2025
@ambis
Copy link
Author

ambis commented Feb 4, 2025

If I structure the list_item resource as per the documentation:

resource "cloudflare_list_item" "item" {
  for_each = {
    "1.1.1.1" = "comment1"
    "8.8.8.8" = "comment2"
  }

  account_id = var.cloudflare_account_id
  list_id    = cloudflare_list.list.id
  
  body = [{
    ip = each.key
    comment = each.value
  }]
}

I get

│ Error: Unsupported argument
│
│   on file.tf line 54, in resource "cloudflare_list_item" "item":
│   54:   body = [{
│
│ An argument named "body" is not expected here.

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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

1 participant