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

turnstile: rename id to sitekey #3280

Closed
wants to merge 1 commit into from

Conversation

vasilevalex
Copy link

Fixes #3093

Copy link
Contributor

github-actions bot commented May 1, 2024

changelog detected ✅

Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR! unfortunately, it can't be accepted as is. all resources must have the id field as part of their schema. where it overlaps with another identifier, behind the scenes we can just reuse that value.

@vasilevalex
Copy link
Author

Hi @jacobbednarz
Yes, sorry I don't have experience of terraform provider development. I just wanted to use widget for my small Hugo blog hosted on Cloudflare Pages. And with this patch I at least created the widget.

So if you can help me with some questions:

  1. What should regular user expect to receive from terraform? 'id' with several comments everywhere in the examples and in the documentation explaining that 'id' is actually sitekey. Or just use 'sitekey' the same way as it is implemented in API?
  2. As I can see the code just remapps 'id' <-> 'sitekey'. But this document says that this "should not" be done: https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/contributing/provider-design.md I'm bit confused.

Thanks!

@jacobbednarz
Copy link
Member

  1. What should regular user expect to receive from terraform? 'id' with several comments everywhere in the examples and in the documentation explaining that 'id' is actually sitekey. Or just use 'sitekey' the same way as it is implemented in API?

the id is what we want here since it is used as an anchor for terraform operations and it is aliased to sitekey in the API calls. can you elaborate on what errors (with debug logs) drew you to make the change? @punkeel might be able to help diagnose how you got there with more context.

  1. As I can see the code just remapps 'id' <-> 'sitekey'. But this document says that this "should not" be done: https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/contributing/provider-design.md I'm bit confused.

which part are you referring to? i'm not sure which part you mean however, using the sitekey (primary) value as the id something we do in most resources since they are unique.

@vasilevalex vasilevalex marked this pull request as draft May 3, 2024 13:10
@vasilevalex
Copy link
Author

Thanks for the answers @jacobbednarz, I'll make changes.

@punkeel
Copy link
Member

punkeel commented May 3, 2024

I suspect this sitekey/id is a red herring, and the real issue is around error handling in Terraform... at least, from what I've seen, every time the API returns an error, the state gets corrupted (which leads to a similar "id/sitekey is missing" error message).

Let me file a small PR, see if that helps

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

Successfully merging this pull request may close these issues.

terraform cloudflare_turnstile_widget Error reading challenge widget when offlabel=true
3 participants