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

resource/cloudflare_list_item: handle overlapping redirect source_url #3335

Merged
merged 1 commit into from
May 31, 2024

Conversation

jacobbednarz
Copy link
Member

To determine the individual list item identifier, we perform an additional HTTP search against the endpoint filtering for the value. In the case of IPs, we use a "starts with" match whereas for redirects, it is a contains. This creates an edge whereby if you have a multiple redirects whereby they share a substring, you cannot differentiate them.

This introduces an additional loop performing an exact match against what the user has provided with all found search results.

NB: For a small dataset, this is manageable however, for 10+ similar items, you are very likely to exhaust your API quota due to additional requests. In the future, the service will improve the search to provide different search match types which we can lean on here instead.

To determine the individual list item identifier, we perform an
additional HTTP search against the endpoint filtering for the value. In
the case of IPs, we use a "starts with" match whereas for redirects, it
is a contains. This creates an edge whereby if you have a multiple
redirects whereby they share a substring, you cannot differentiate them.

This introduces an additional loop performing an exact match against
what the user has provided with all found search results.

NB: For a small dataset, this is manageable however, for 10+ similar
items, you are very likely to exhaust your API quota due to additional
requests. In the future, the service will improve the search to provide
different search match types which we can lean on here instead.
Copy link
Contributor

changelog detected ✅

@jacobbednarz
Copy link
Member Author

acceptance tests all passing

TF_ACC=1 go test ./internal/framework/service/list_item -v -run "^TestAccCloudflareListItem_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareListItem_Basic
=== PAUSE TestAccCloudflareListItem_Basic
=== RUN   TestAccCloudflareListItem_MultipleItems
--- PASS: TestAccCloudflareListItem_MultipleItems (20.99s)
=== RUN   TestAccCloudflareListItem_Update
--- PASS: TestAccCloudflareListItem_Update (31.46s)
=== RUN   TestAccCloudflareListItem_BadListItemType
--- PASS: TestAccCloudflareListItem_BadListItemType (5.72s)
=== RUN   TestAccCloudflareListItem_ASN
--- PASS: TestAccCloudflareListItem_ASN (14.67s)
=== RUN   TestAccCloudflareListItem_Hostname
--- PASS: TestAccCloudflareListItem_Hostname (25.33s)
=== RUN   TestAccCloudflareListItem_Redirect
--- PASS: TestAccCloudflareListItem_Redirect (16.42s)
=== RUN   TestAccCloudflareListItem_RedirectWithOverlappingSourceURL
--- PASS: TestAccCloudflareListItem_RedirectWithOverlappingSourceURL (33.41s)
=== CONT  TestAccCloudflareListItem_Basic
--- PASS: TestAccCloudflareListItem_Basic (16.86s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/list_item	166.078s

@jacobbednarz jacobbednarz merged commit a8fac49 into master May 31, 2024
10 checks passed
@jacobbednarz jacobbednarz deleted the handle-overlapping-redirect-source-url branch May 31, 2024 02:05
@github-actions github-actions bot added this to the v4.35.0 milestone May 31, 2024
Copy link
Contributor

This functionality has been released in v4.35.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 Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant