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

Support for immediate notification #396

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

koushik-swaminathan
Copy link
Contributor

@koushik-swaminathan koushik-swaminathan commented Aug 3, 2023

Allows send_after field to be set as 0 for immediate notification.

Copy link

@stp-bsh stp-bsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stp-bsh
Copy link

stp-bsh commented Aug 10, 2023

@koushik-swaminathan Any news in that regard? The change looks promising, would like to see it in the final code 😁

@stp-bsh
Copy link

stp-bsh commented Sep 1, 2023

@koushik-swaminathan Do you see a chance to implement this improvement/bugfix in the near future?

@koushik-swaminathan
Copy link
Contributor Author

koushik-swaminathan commented Oct 17, 2023

@stp-bsh there's some changed in the go-sdk as well, I will merge this PR once those changes have been merged.
opsgenie/opsgenie-go-sdk-v2#137

@koushik-swaminathan koushik-swaminathan force-pushed the add-support-immediate-notification branch from da0e354 to 9cd60a9 Compare October 18, 2023 07:49
@koushik-swaminathan koushik-swaminathan merged commit 70e1f11 into master Oct 18, 2023
1 check passed
@koushik-swaminathan
Copy link
Contributor Author

@stp-bsh, PR has been merged, the latest release should support 0 value for send_after.

@stp-bsh
Copy link

stp-bsh commented Oct 18, 2023

@koushik-swaminathan Thank you!

@stp-bsh
Copy link

stp-bsh commented Oct 24, 2023

@koushik-swaminathan Once again thank you for fixing it, but unfortunately there is only a tag v0.6.33 but no release available. Because of that the new version can't be used in terraform. Is there any chance to have the new release in the near future?

image

versus

image

@koushik-swaminathan
Copy link
Contributor Author

Hi @stp-bsh, it was under draft, I have released the latest version now!

@selfuryon
Copy link

Hello!
For me, it doesn't work unfortunately:

resource "opsgenie_notification_rule" "P5-notifications" {
  name        = "P5 Notification"
  username    = data.opsgenie_user.admins["***"].username
  action_type = "create-alert"
  steps {
    send_after = 0
    contact {
      method = "email"
      to     = "***"
    }
  }
  criteria {
    type = "match-any-condition"
    conditions {
      field          = "priority"
      operation      = "equals"
      expected_value = "P5"
    }
  }
  order = 100
  time_restriction {
    type = "time-of-day"
    restriction {
      start_hour = 10
      start_min  = 0
      end_hour   = 19
      end_min    = 0
    }
  }
}

And after terraform apply:

Terraform will perform the following actions:

  # opsgenie_notification_rule.P5-notifications will be updated in-place
  ~ resource "opsgenie_notification_rule" "P5-notifications" {
        id                = "e92eb679-3c6d-4421-bb26-27d8080f1b81"
        name              = "P5 Notification"
      ~ order             = 13 -> 100
        # (4 unchanged attributes hidden)

      ~ steps {
          ~ send_after = 1 -> 0
            # (1 unchanged attribute hidden)

            # (1 unchanged block hidden)
        }

        # (2 unchanged blocks hidden)
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

opsgenie_notification_rule.P5-notifications: Modifying... [id=e92eb679-3c6d-4421-bb26-27d8080f1b81]
╷
│ Error: Error occurred with Status code: 422, Message: Request body is not processable. Please check the errors., Took: 0.001000, RequestId: 3b82b571-a514-483f-a6b5-44dc84d60851, Error Detail: map[timeAmount:must not be null]
│
│   with opsgenie_notification_rule.P5-notifications,
│   on notification-rules.tf line 2, in resource "opsgenie_notification_rule" "P5-notifications":
│    2: resource "opsgenie_notification_rule" "P5-notifications" {

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

Successfully merging this pull request may close these issues.

4 participants