terraform-provider-opsgenie
terraform-provider-opsgenie copied to clipboard
Duplicated alerts in opsgenie_integration_action
Terraform Version
Terraform v1.4.2 on darwin_amd64
- provider registry.terraform.io/opsgenie/opsgenie v0.6.20
Affected Resource(s)
- opsgenie_integration_action
Terraform Configuration Files
terraform {
required_providers {
opsgenie = {
source = "opsgenie/opsgenie"
version = "0.6.20"
}
}
required_version = "= 1.4.2"
}
# export OPSGENIE_API_KEY environment variable
provider "opsgenie" {}
resource "opsgenie_email_integration" "test" {
name = "mail-test"
email_username = "test"
}
resource "opsgenie_integration_action" "actions" {
integration_id = opsgenie_email_integration.test.id
create {
name = "Test 1"
source = "Email"
note = "Test 1"
filter {
type = "match-any-condition"
conditions {
field = "subject"
operation = "contains"
expected_value = "test"
}
conditions {
field = "From Address"
operation = "contains"
expected_value = "[email protected]"
}
}
responders {
id = "ff2c2f8f-54d7-4071-92a9-f6cac5d8b076"
type = "team"
}
}
create {
name = "Test 2"
description = "Test"
note = "Test"
source = "Email test 2"
filter {
type = "match-any-condition"
conditions {
field = "From Address"
operation = "contains"
expected_value = "[email protected]"
}
conditions {
field = "subject"
operation = "contains"
expected_value = "test"
}
}
responders {
id = "a5a077b1-dc13-45de-a961-9a91ddda1836"
type = "team"
}
}
}
Expected Behavior
The terraform code should create a opsgenie_integration_action with two alerts ("Test 1" and "Test 2") if you run it initially. A second terraform plan/apply shouldn't show/perform any changes.
Actual Behavior
When you apply the code initially it creates the opsgenie_integration_action with the two alerts as expected, but if you plan it a second time, it shows unexpected changes (resorting of the alerts). If you apply the changes you can see both alerts created twice with the same names an contents (see screenshots). If you really doing a change (like changing a value of a field), it just duplicates the alert which wasn't changed.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply- check integration in opsgenie

terraform applyagain (unexpected reordering)- check integration in opsgenie again

Important Factoids
The unexpected behaviour only happens if the responders argument is set for the alerts.