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

Duplicate ID assignment for multiple cloudflare_list_item resources #2848

Closed
2 tasks done
agesta23 opened this issue Oct 13, 2023 · 4 comments · Fixed by #2922
Closed
2 tasks done

Duplicate ID assignment for multiple cloudflare_list_item resources #2848

agesta23 opened this issue Oct 13, 2023 · 4 comments · Fixed by #2922
Labels
triage/duplicate Indicates an issue is a duplicate of other open issue.
Milestone

Comments

@agesta23
Copy link

agesta23 commented Oct 13, 2023

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.6.1
on darwin_arm64

Affected resource(s)

cloudflare_list_item

Terraform configuration files

resource "cloudflare_list_item" "this_item" {
  for_each    = { for entry in var.ip_entries : entry.ip => entry }

  account_id  = var.account_id
  list_id     = cloudflare_list.this.id
  comment     = each.value.comment
  ip          = each.value.ip
}

Link to debug output

https://gist.github.com/agesta23/83f8b7bf5eaa618a2c0b99dda4cdcd82

Panic output

No response

Expected output

  • When creating multiple Cloudflare list items using the cloudflare_list_item resource in a Terraform module, each resource should be assigned a unique ID based on the Cloudflare list item that was created.

Actual output

  • Upon running Terraform apply and examining the state, I found that different cloudflare_list_item resources were mapped to the same Cloudflare list item ID.

Steps to reproduce

1. Define Cloudflare resources:

  • Create a cloudflare_list and cloudflare_list_item resources in your Terraform configuration.
resource "cloudflare_list" "this" {
  account_id  = var.account_id
  name        = var.name
  description = var.description
  kind        = "ip"
}

resource "cloudflare_list_item" "this_item" {
  for_each    = { for entry in var.ip_entries : entry.ip => entry }
  account_id  = var.account_id
  list_id     = cloudflare_list.this.id
  comment     = each.value.comment
  ip          = each.value.ip
}

2. Module Setup:

module "cloudflare_ip_list" {
  source      = "./path_to_your_module"
  account_id  = "your_account_id"
  name        = "my_ip_list"
  description = "This is a test IP list"
  ip_entries = [
    {
      ip      = "22.11.33.44"
      comment = "dummy ip 1"
    },
    {
      ip      = "22.11.33.55"
      comment = "dummy ip 2"
    },
    {
      ip      = "22.11.33.88"
      comment = "dummy ip 3"
    }
  ]
}

3. Configuration apply.

  • Run terraform apply and confirm the creation of the resources.

4. Observe output(if defined) or state file

cloudflare_list_id = "redacted"
cloudflare_list_item_ids = [
  "506618aea5c64452b2a3397b69ac9ab6",
  "506618aea5c64452b2a3397b69ac9ab6",
  "506618aea5c64452b2a3397b69ac9ab6"
]

Additional factoids

No response

References

No response

@agesta23 agesta23 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 Oct 13, 2023
@github-actions
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.

@github-actions
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 Oct 13, 2023
@danquack
Copy link
Contributor

I think this might be a duplicate of #2559

@jacobbednarz jacobbednarz added triage/duplicate Indicates an issue is a duplicate of other open issue. and removed 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. labels Oct 21, 2023
@jacobbednarz jacobbednarz closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2023
@github-actions github-actions bot added this to the v4.19.0 milestone Nov 9, 2023
Copy link
Contributor

This functionality has been released in v4.19.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage/duplicate Indicates an issue is a duplicate of other open issue.
Projects
None yet
3 participants