-
-
Notifications
You must be signed in to change notification settings - Fork 140
conditions_v2 event frequency value cannot be zero, "ensure all required fields are filled in" #575
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
Comments
fajpunk
added a commit
to fajpunk/terraform-provider-sentry
that referenced
this issue
Apr 8, 2025
fajpunk
added a commit
to fajpunk/terraform-provider-sentry
that referenced
this issue
Apr 8, 2025
There is [arguably a bug in the Sentry API](https://github.com/getsentry/sentry/blob/7b8d66494904659365bbc0e5b37db029d72ef36d/src/sentry/api/serializers/rest_framework/rule.py#L40-L42) where integer values of 0 will be stripped from submitted payload objects because of Python's implicit bool conversions. These values can successfully be submitted as strings. When these objects are retrieved from the API, the values are integers. To model this, we have two different schemas in the OpenAPI spec yaml for rule conditions based based on whether we're sending them to the API or retriving them from the API: * `ProjectRuleCondition`, which is a set of condition schemas where `value`s are `integers` * `ProjectRuleConditionToApi` which is a set of condition schemas where `value`s are strings The generated types from these are used in the alert rule resource code in the `Fill` and `ToApi` methods as necessary. There may be a way to do this without so much duplication, I am definitely open to suggestions!
fajpunk
added a commit
to fajpunk/terraform-provider-sentry
that referenced
this issue
Apr 8, 2025
There is [arguably a bug in the Sentry API](https://github.com/getsentry/sentry/blob/7b8d66494904659365bbc0e5b37db029d72ef36d/src/sentry/api/serializers/rest_framework/rule.py#L40-L42) where integer values of 0 will be stripped from submitted payload objects because of Python's implicit bool conversions. These values can successfully be submitted as strings. When these objects are retrieved from the API, the values are integers. To model this, we have two different schemas in the OpenAPI spec yaml for rule conditions based based on whether we're sending them to the API or retriving them from the API: * `ProjectRuleCondition`, which is a set of condition schemas where `value`s are `integers` * `ProjectRuleConditionToApi` which is a set of condition schemas where `value`s are strings The generated types from these are used in the alert rule resource code in the `Fill` and `ToApi` methods as necessary. There may be a way to do this without so much duplication, I am definitely open to suggestions!
Seems like Sentry is not going to allow this in the future. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With
conditions_v2
, if I setvalue
ofevent_frequency
to zero, it fails:Here's a sample resource. It works if "value" is 1, fails if it's
0
or even"0"
.If I set the value to zero in the UI and it is set to, say, one in terraform, it properly shows drift:
Using jianyuan/sentry version
0.14.3
, terraformv1.9.5
.The text was updated successfully, but these errors were encountered: