-
-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Description
There have been multiple reports highlighting difficulties in configuring issue alert conditions, filters, and actions directly using JSON. The challenges primarily stem from limitations in the way the Sentry API currently functions:
- Lack of JSON Validation: JSON inputs provided by users are not validated adequately by the provider, leading to potential errors during configuration.
- Type Mismatches: Some inputs require integers to be passed via the API but are returned as strings in the response. This discrepancy necessitates complex and error-prone fuzzy matching logic to ensure compatibility.
- Extra Fields in API Responses: The Sentry API often returns additional fields that are not part of the input schema. These fields introduce discrepancies and complicate Terraform's matching logic, making it harder to detect and manage changes effectively.
- dynamic_form_fields: Some actions require
dynamic_form_fieldsto be set. They must be set to anything truthy and is not validated.
Proposed Solution:
To address these issues, I propose introducing a new structure for defining issue alerts using a well-defined Terraform resource. This approach leverages Terraform's attribute-based configuration to improve usability, validation, and maintainability. Below is an example of the proposed syntax:
resource "sentry_issue_alert" "test" {
organization = sentry_project.test.organization
project = sentry_project.test.id
name = "%[3]s"
action_match = "any"
filter_match = "any"
frequency = 30
# Conditions
condition {
first_seen_event {}
}
condition {
regression_event {}
}
condition {
event_frequency {
value = 500
interval = "1h"
}
}
condition {
event_unique_user_frequency {
value = 1000
interval = "15m"
}
}
condition {
event_frequency_percent {
value = 50.0
interval = "10m"
}
}
# Filters
filter {
age_comparison {
comparison_type = "older"
value = 10
time = "minute"
}
}
# Actions
action {
notify_email {
target_type = "IssueOwners"
fallthrough_type = "ActiveMembers"
}
}
action {
notify_email {
target_type = "Team"
target_identifier = sentry_team.test.internal_id
fallthrough_type = "AllMembers"
}
}
action {
slack_notify_service {
workspace = data.sentry_organization_integration.slack.id
channel = "#general"
tags = "environment,level"
notes = "Please <http://example.com|click here> for triage information"
}
}
action {
github_create_ticket {
integration = data.sentry_organization_integration.github.id
repo = "terraform-provider-sentry"
title = "My Test Issue"
assignee = "jianyuan"
labels = ["bug", "enhancement"]
}
}
action {
azure_devops_create_ticket {
integration = data.sentry_organization_integration.vsts.id
project = "123"
work_item_type = "Microsoft.VSTS.WorkItemTypes.Task"
}
}
action {
pagerduty_notify_service {
account = sentry_integration_pagerduty.pagerduty.integration_id
service = sentry_integration_pagerduty.pagerduty.id
severity = "default"
}
}
action {
opsgenie_notify_team {
account = sentry_integration_opsgenie.opsgenie.integration_id
team = sentry_integration_opsgenie.opsgenie.id
priority = "P1"
}
}
action {
notify_event {}
}
}Angelodaniel, glsignal, toshiki-ishii and amontalva1
Metadata
Metadata
Assignees
Labels
No labels