terraform-provider-opsgenie
terraform-provider-opsgenie copied to clipboard
opsgenie_notification_policy - policy order
Hi there,
I have several notification policies and I don't see a way to change the policy order with terraform.
OpsGenie API is supporting this with the endpoint: https://api.opsgenie.com/v2/policies/:identifier/change-order
Here the link to documentation: https://docs.opsgenie.com/docs/alert-and-notification-policy-api#change-policy-order
With regards Andreas
also waiting for fo this feature
here is a workaround
provisioner "local-exec" {
when = create
# "environment" used as workaround not to expose api key in ci output
# we use tf 0.12
environment = {
KEY = var.opsgenie_api_key
}
command = <<EOT
echo self
if [ ! -z "${each.value.order}" ] && [ ! -z "$KEY" ]; then
echo ${each.value.order}
curl -X POST 'https://api.opsgenie.com/v2/policies/${self.id}/change-order?teamId=${opsgenie_team.this.id}' \
--header "Authorization: GenieKey $KEY" \
--header 'Content-Type: application/json' \
-d'{
"targetIndex":"${each.value.order}"
}';
fi
EOT
}