opsgenie / terraform-provider-opsgenie

Terraform OpsGenie provider
https://registry.terraform.io/providers/opsgenie/opsgenie/latest/docs
Mozilla Public License 2.0
100 stars 135 forks source link

Error: Error occurred with Status code: 422, Message: Integration with type 'jira-software-cloud' does not exist #442

Open marcossv9 opened 1 month ago

marcossv9 commented 1 month ago

Hi there,

I'm trying to automate the creation of the jira cloud bidirectional integration with opsgenie using the terraform provider and couldn't find the right opsgenie api integration type for it. This list only mention the Jira integration that references the legacy product and not Jira Cloud. Clearly, the documentation is outdated and not reflecting the actual behavior of the opsgenie api, that seems to be using the jira-software-cloud value for integration type, but that doesn't work.

Terraform Version

Terraform v1.5.5 on linux_amd64

Affected Resource(s)

Terraform Configuration Files

resource "opsgenie_api_integration" "jira-integration" {
  name     = "Jira Integration"
  type     = "jira-software-cloud"

  allow_write_access             = true
  enabled                        = true
  ignore_responders_from_payload = false
  suppress_notifications         = false
}

Debug Output

Terraform will perform the following actions:

  # opsgenie_api_integration.jira-integration will be created
  + resource "opsgenie_api_integration" "jira-integration" {
      + allow_write_access             = true
      + api_key                        = (sensitive value)
      + enabled                        = true
      + id                             = (known after apply)
      + ignore_responders_from_payload = false
      + name                           = "Jira Integration"
      + suppress_notifications         = false
      + type                           = "jira-software-cloud"
    }

Panic Output

│ Error: Error occurred with Status code: 422, Message: Integration with type 'jira-software-cloud' does not exist., Took: 0.001000, RequestId: 862839cd-3647-4f86-ac22-9f12f5eaa868
│ 
│   with opsgenie_api_integration.jira-integration,
│   on teams.tf line 38, in resource "opsgenie_api_integration" "jira-integration":
│   38: resource "opsgenie_api_integration" "jira-integration" {
│ 
╵
Releasing state lock. This may take a few moments...

Expected Behavior

the opsgenie api integration for jira cloud is created correctly.

Actual Behavior

an error mentioned above. it works fine when I use Jira as the type, but that creates an integration for the Legacy Jira app.

Steps to Reproduce

  1. terraform apply
tparramonLM commented 4 weeks ago

Hi there, I would like to provide additional details regarding these Jira integrations.

As far from now, we can add 2 different Jira API integrations under Opsgenie Integrations:

Add-Integration

Under the first option, "Jira" integration, we can select 2 different integration variants:

Jira

Likewise, under "Jira Service Management" integration, we can select 2 different integration variants:

Jira-Service-Management

Essentially, we have 4 different integration variants with the following type names :

Jira

{
    "id":"xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx",
    "name":"test-jira-legacy",
    "enabled":false,
    "type":"Jira",
    "teamId":"xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx",
    "version":"v2",
    "advanced":true
}

Jira Service Management

According to the documentation available at https://support.atlassian.com/opsgenie/docs/integration-types-to-be-used-with-the-api/, only two distinct Jira integrations are supported, corresponding to the v2 version and not the v3.

Integration Name Link API TypeName
Atlassian Jira Integrate Opsgenie with Jira Jira
Atlassian Jira Service Management Integrate Opsgenie with Jira Service Management JiraServiceDesk

Summarizing:

Are there any plans or expectations regarding when we will be able to support the v3 integrations that are not currently supported?