-
Notifications
You must be signed in to change notification settings - Fork 630
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
Fix error handling in cloudflare_turnstile #3284
Conversation
When we receive an error from the API, we would record an error (not return) and write an invalid State. For some reason, Terraform accepts it... yet it seems to corrupt the tf state. Add some returns to handle error more cleanly.
changelog detected ✅ |
617157f
to
3ef096f
Compare
|
Did you mean to cc me? |
My bad, I meant to cc @vasilevalex. |
terraform doesn't prevent the state from being written as it cannot make decisions about what values should and should not be modified with the error response so it's up to the provider to determine the correct course of action. i'm on the fence here if we want to return early here as it basically negates anything that happens after this in the resource operation (including the good values). however, given the |
acceptance tests all passing
|
@jacobbednarz thanks & thanks for the link! The weird part to me is: we declare a See #3285 for other places where we may want to return on errors (with a bonus semgrep) |
This functionality has been released in v4.32.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! |
When we receive an error from the API, we would record an error (not return) and write an invalid State. For some reason, Terraform accepts it... yet it seems to corrupt the tf state.
Add some returns to handle error more cleanly.
Related: #3093 (but unsure if that's the only fix required)