opsgenie / terraform-provider-opsgenie

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

Cannot delete escalation #308

Closed nitrocode closed 2 years ago

nitrocode commented 2 years ago

Terraform Version

⨠ terraform -v
Terraform v1.1.9
on linux_amd64
+ provider registry.terraform.io/cloudposse/utils v0.17.25
+ provider registry.terraform.io/hashicorp/aws v4.19.0
+ provider registry.terraform.io/hashicorp/external v2.2.2
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/opsgenie/opsgenie v0.6.10

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "opsgenie_escalation" "this" {
  description   = "P1 Critical Alerts"
  name          = "P1"
  owner_team_id = opsgenie_team.this.id

  rules {
    condition   = "if-not-acked"
    delay       = 0
    notify_type = "default"

    recipient {
      id   = opsgenie_schedule.this.id
      type = "schedule"
    }
  }

  rules {
    condition   = "if-not-acked"
    delay       = 0
    notify_type = "default"

    recipient {
      id   = opsgenie_schedule.this.id
      type = "schedule"
    }
  }

  rules {
    condition   = "if-not-acked"
    delay       = 15
    notify_type = "next"

    recipient {
      id   = opsgenie_schedule.this.id
      type = "schedule"
    }
  }

  rules {
    condition   = "if-not-acked"
    delay       = 15
    notify_type = "next"

    recipient {
      id   = opsgenie_schedule.this.id
      type = "schedule"
    }
  }

  rules {
    condition   = "if-not-acked"
    delay       = 30
    notify_type = "users"

    recipient {
      id   = opsgenie_team.this.id
      type = "team"
    }
  }
}

Debug Output

This is the main error I get

│ Error: Error occurred with Status code: 428, Message: Escalation cannot be modified. Please remove it from teams: [cloud], Took: 0.037000, RequestId: 1ae8b1e6-7603-4f92-bcc0-43864765ec54
│

using TF_LOG=debug

2022-06-23T22:51:25.207Z [INFO]  provider.terraform-provider-opsgenie_v0.6.10: 2022/06/23 22:51:25 [INFO] Initializing OpsGenie client: timestamp=2022-06-23T22:51:25.207Z
2022-06-23T22:51:25.207Z [INFO]  provider.terraform-provider-opsgenie_v0.6.10: 2022/06/23 22:51:25 [INFO] OpsGenie client configured: timestamp=2022-06-23T22:51:25.207Z
2022-06-23T22:51:25.208Z [WARN]  unexpected data: registry.terraform.io/opsgenie/opsgenie:stderr="INFO[2022-06-23T22:51:25.207655305Z] Client is configured with ApiUrl: api.opsgenie.com, LogLevel: info, RetryMaxCount: 10"
module.escalations["P1"].opsgenie_escalation.this[0]: Destroying... [id=31c4c0ba-c122-4c0c-b794-c17d713e1a9e]
2022-06-23T22:51:25.210Z [INFO]  Starting apply for module.escalations["P1"].opsgenie_escalation.this[0]
2022-06-23T22:51:25.210Z [DEBUG] module.escalations["P1"].opsgenie_escalation.this[0]: applying the planned Delete change
2022-06-23T22:51:25.212Z [INFO]  provider.terraform-provider-opsgenie_v0.6.10: 2022/06/23 22:51:25 [INFO] Deleting OpsGenie escalation 'P1': timestamp=2022-06-23T22:51:25.212Z
2022-06-23T22:51:25.212Z [WARN]  unexpected data: registry.terraform.io/opsgenie/opsgenie:stderr="INFO[2022-06-23T22:51:25.212492644Z] Client is configured with ApiUrl: api.opsgenie.com, LogLevel: info, RetryMaxCount: 10"
2022-06-23T22:51:25.494Z [WARN]  unexpected data: registry.terraform.io/opsgenie/opsgenie:stderr="ERRO[2022-06-23T22:51:25.493628705Z] Error occurred with Status code: 428, Message: Escalation cannot be modified. Please remove it from teams: [platform-cloud], Took: 0.047000, RequestId: 3d0813e5-16dc-4531-8959-7725dd814bcb"
2022-06-23T22:51:25.497Z [ERROR] vertex "module.escalations[\"P1\"].opsgenie_escalation.this[0] (destroy)" error: Error occurred with Status code: 428, Message: Escalation cannot be modified. Please remove it from teams: [platform-cloud], Took: 0.047000, RequestId: 3d0813e5-16dc-4531-8959-7725dd814bcb

Panic Output

N/A

Expected Behavior

Successful destroy

Actual Behavior

Unsuccessful destroy

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform destroy

Important Factoids

References

N/A

nitrocode commented 2 years ago

A depends on for the routing rules seemed to work.