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

trigger_webhook missing on grafana_oncall_escalation

Open rosilva-85 opened this issue 2 years ago • 7 comments

Terraform Version

  • Terraform: 1.5.6
  • Terraform Grafana Provider: 2.2.0
  • Grafana: Cloud v10.2.0

Affected Resource(s)

  • grafana_oncall_escalation

Terraform Configuration Files

resource "grafana_oncall_escalation" "call_webhook" {
  provider = grafana.cloud
  escalation_chain_id = grafana_oncall_escalation_chain.demo.id
  type                = "trigger_webhook"
  position = 0

  depends_on = [
    grafana_oncall_escalation_chain.demo
  ]
}

Expected Behavior

Add an escalation step to call a outgoing webhook, as I can do on the ui.

Actual Behavior

The option is not available on the provider, so it breaks. If I do an import of the pre prexisting object, terraform detects it as trigger_webhook

"provider": "provider["registry.terraform.io/grafana/grafana"].cloud", "instances": [ { "schema_version": 0, "attributes": { "action_to_trigger": "", "duration": 0, "escalation_chain_id": "FSN1R71*****", "group_to_notify": "", "id": "EWWYXWYV*****", "important": false, "notify_if_time_from": "", "notify_if_time_to": "", "notify_on_call_from_schedule": "", "persons_to_notify": [], "persons_to_notify_next_each_time": [], "position": 3, "type": "trigger_webhook" }

Steps to Reproduce

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

Try to create an escalation step based on an outgoing webhook with terraform

rosilva-85 avatar Aug 27 '23 17:08 rosilva-85

Seems that is not supported here:

https://github.com/grafana/terraform-provider-grafana/blob/v2.2.0/internal/resources/oncall/resource_escalation.go#L17-L28

So I think is an enhancement in this case, not a bug

rosilva-85 avatar Aug 27 '23 18:08 rosilva-85

You want to use the trigger_action.

holgerson97 avatar Sep 07 '23 07:09 holgerson97

I have tried to use trigger_action, with no luck.

Is there any working example with trigger action to execute an external_webhook?

rosilva-85 avatar Sep 10 '23 16:09 rosilva-85

oncall 1.3.29

set up

resource "grafana_oncall_escalation" "test" { provider = grafana.oncall escalation_chain_id = grafana_oncall_escalation_chain.test.id action_to_trigger = grafana_oncall_outgoing_webhook.test.id type = "trigger_action" position = 0 }

result

400 {action_to_trigger: [Object does not exist]}

Maybe it's a version issue ?

swxlbjs avatar Sep 11 '23 03:09 swxlbjs

If you import the resource with terraform import, the type on the on call api is: "type": "trigger_webhook"

I've also tried to do it via API, but doesn't work:

{"escalation_chain_id":["Object does not exist"],"action_to_trigger":["Object does not exist"]}%

https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_policies/#create-an-escalation-policy

rosilva-85 avatar Sep 11 '23 05:09 rosilva-85

I have the same error using the API directly, I opened a support ticket. It seems to be an issue with the API itself.

When receiving a helpful response I will inform you guys.

holgerson97 avatar Sep 11 '23 08:09 holgerson97

any update on this?

rosilva-85 avatar Oct 22 '23 18:10 rosilva-85

hi there 👋 please try upgrading to 2.15.0 which was just released. trigger_webhook should be the correct type value for your use case here. let me know if you still face this issue.

joeyorlando avatar Apr 05 '24 16:04 joeyorlando