terraform-provider-grafana
terraform-provider-grafana copied to clipboard
trigger_webhook missing on grafana_oncall_escalation
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
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
You want to use the trigger_action.
I have tried to use trigger_action, with no luck.
Is there any working example with trigger action to execute an external_webhook?
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 ?
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
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.
any update on this?
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.