terraform-provider-opsgenie icon indicating copy to clipboard operation
terraform-provider-opsgenie copied to clipboard

unable to enable notification with resource opsgenie_api_integration and type Mattermost

Open dneven opened this issue 1 year ago • 1 comments

Dear opsgenie-team.

I am not able to enable notifications to mattermost via opsgenie_api_integration resource. Maybe i am holding it wrongly. Then i would love to see a working example in the Docs.

Terraform Version

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/opsgenie/opsgenie v0.6.35

Affected Resource(s)

  • opsgenie_api_integration

Terraform Configuration Files

resource "opsgenie_api_integration" "mattermost" {
  name = "Mattermost"
  type = "Mattermost"

  webhook_url             = "https://mattermost.myexample.com/hooks/w77C7xOZffiv57b8irBApAxMJCQA6XMb"
  enabled                 = true
  allow_write_access      = false
  suppress_notifications  = false
  owner_team_id           = data.terraform_remote_state.state_200.outputs.team.id
}

On first run the integration in set up, but not fully.

Terraform will perform the following actions:

  # opsgenie_api_integration.mattermost will be created
  + resource "opsgenie_api_integration" "mattermost" {
      + allow_write_access     = false
      + api_key                = (sensitive value)
      + enabled                = true
      + id                     = (known after apply)
      + name                   = "Mattermost"
      + owner_team_id          = "ID-OF-TEAM"
      + suppress_notifications = false
      + type                   = "Mattermost"
      + webhook_url            = "https://mattermost.myexample.com/hooks/w77C7xOZffiv57b8irBApAxMJCQA6XMb"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

...

opsgenie_api_integration.sre_mattermost: Creating...
opsgenie_api_integration.sre_mattermost: Creation complete after 1s [id=541d89c8-e14f-424a-bc3f-bdf9e67951e3]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

On second run terraform is updating the webhook_url again. After this it is show by the opsgenie web ui. Normally i would expect this to set up on the first run too. (maybe a second bug)

Terraform will perform the following actions:

  # opsgenie_api_integration.sre_mattermost will be updated in-place
  ~ resource "opsgenie_api_integration" "mattermost" {
        id                     = "ID-OF-INTEGRATION"
        name                   = "Mattermost"
      + webhook_url            = "https://mattermost.myexample.com/hooks/w77C7xOZffiv57b8irBApAxMJCQA6XMb"
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

...

opsgenie_api_integration.sre_mattermost: Modifying... [id=541d89c8-e14f-424a-bc3f-bdf9e67951e3]
opsgenie_api_integration.sre_mattermost: Modifications complete after 1s [id=541d89c8-e14f-424a-bc3f-bdf9e67951e3]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

dneven avatar Feb 02 '24 10:02 dneven

I am not really firm with go, but get a working patch for me. Would like that someone with more go experience is interested in brings it back into main.

working.patch

dneven avatar Feb 07 '24 11:02 dneven