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

Is Jira supported for issue alerts? #278

Closed
raypettersen opened this issue Feb 9, 2023 · 3 comments
Closed

Is Jira supported for issue alerts? #278

raypettersen opened this issue Feb 9, 2023 · 3 comments

Comments

@raypettersen
Copy link

I've created a manually configured action in Sentry. The action registers a JIRA issue with a set component, and it works really well.

Since we have lots of projects and I'd like to automate the rule across them all, I've attempted to copy the existing action over to a new terraform resource as mentioned as a tip in the configuration.

data "sentry_issue_alert" "original" {
  organization = "redacted"
  project      = "redacted"
  internal_id  = "redacted"
}

# Create a copy of an Issue Alert
resource "sentry_issue_alert" "copy" {
  organization = data.sentry_issue_alert.original.organization
  project      = data.sentry_issue_alert.original.project

  # Copy and modify attributes as necessary.

  name = "${data.sentry_issue_alert.original.name}-copy"

  action_match = data.sentry_issue_alert.original.action_match
  filter_match = data.sentry_issue_alert.original.filter_match
  frequency    = data.sentry_issue_alert.original.frequency

  conditions = data.sentry_issue_alert.original.conditions
  filters    = data.sentry_issue_alert.original.filters
  actions    = []
}

However I'm faced with this error:

│ Error: 1 error occurred:
│ 	* actions.0.components: '' expected type 'string', got unconvertible type '[]interface {}', value: '[redacted-integer]'
│
│
│
│   with data.sentry_issue_alert.original,
│   on main.tf line 59, in data "sentry_issue_alert" "original":
│   59: data "sentry_issue_alert" "original" {

So I'm wondering if JIRA is supported, and if anyone else has had more luck with similar scenarios?

@rossnelson
Copy link

Same issue here. Looks like it fails parsing the response when there are nested objects as its defined as a simple []map[string]string

@rossnelson
Copy link

rossnelson commented Sep 13, 2023

Im wondering if it makes more sense to handle the actions and other highly configurable properties similar to this resource: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy.html

@jianyuan
Copy link
Owner

I have made conditions, filters, and actions JSON string fields to support highly configurable properties. See examples of JIRA support here: https://registry.terraform.io/providers/jianyuan/sentry/latest/docs/resources/issue_alert#example-usage

#
# Create a Jira Ticket
#

data "sentry_organization_integration" "jira" {
  organization = sentry_project.test.organization

  provider_key = "jira"
  name         = "JIRA" # Name of your Jira server
}

resource "sentry_issue_alert" "jira_alert" {
  actions = <<EOT
[
  {
    "id": "sentry.integrations.jira.notify_action.JiraCreateTicketAction",
    "integration": ${parseint(data.sentry_organization_integration.jira.id, 10)},
    "project": "349719"
    "issueType": "1"
  }
]
EOT
  // ...
}

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

No branches or pull requests

3 participants