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

filter: Propagate schema validation error to end user #860

Conversation

jacobbednarz
Copy link
Member

@jacobbednarz jacobbednarz commented Nov 5, 2020

#848 introduced better validation for filters using the Terraform
schema. Despite handling the error, the error wasn't returned to the end
user and instead the RPC exception is shown the end user.

Error: rpc error: code = Unavailable desc = transport is closing

This fixes the user experience by returning the errors which now passes
the exception onto the end user instead of swallowing it or causing a
panic.

Example of the exception to the end user:

Error: cloudflare_api_key and cloudflare_email are required for validating filter expressions but they are missing

  on main.tf line 37, in resource "cloudflare_filter" "example_filter":
  37: resource "cloudflare_filter" "example_filter" {

cloudflare#848 introduced better validation for filters using the Terraform
schema. Despite handling the error, the error wasn't returned to the end
user and instead the RPC exception is shown the end user.

```
Error: rpc error: code = Unavailable desc = transport is closing
```

This fixes the user experience by returning the errors which now passes
the exception onto the end user instead of swallowing it or causing a
panic.
@jacobbednarz jacobbednarz force-pushed the better-handling-of-missing-creds-for-filter-expressions branch from be556ab to c3010c0 Compare November 5, 2020 03:27
@jacobbednarz jacobbednarz merged commit 58d9cf9 into cloudflare:master Nov 5, 2020
@jacobbednarz jacobbednarz deleted the better-handling-of-missing-creds-for-filter-expressions branch November 5, 2020 04:58
jacobbednarz added a commit to jacobbednarz/terraform-provider-cloudflare that referenced this pull request Nov 5, 2020
Due to the endpoint not supporting API tokens, we needed to build a
standalone client which hasn't worked out well and the workarounds to
fix it are against the grain of how the Terraform schema is intended to
be used leaving us in situation where change in upstream functionality
may force us to be on an older version of the SDK if we were to
continue. Instead, this reverts cloudflare#848 and cloudflare#860 and once API token support
is added to the endpoint, we can reintroduce this without a standalone
client.

Closes cloudflare#861
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.

1 participant