BetterStackHQ / terraform-provider-better-uptime

Apache License 2.0
45 stars 12 forks source link

Data resources for betteruptime_incoming_webhook #60

Closed peter-hippo closed 1 month ago

peter-hippo commented 8 months ago

Hi!

I would be great to have a data resource for betteruptime_incoming_webhook to be able to look up existing web hooks to pass on the URL of the incoming web hook to other resources. My use case is that we create incoming web hooks segmented by environment type (development, staging and production) and this works great. However we have more than one environment of the type production and I need to look up the existing web hook to pass on the URL to other resources, in this case a AWS SNS topic. Currently to solve this I first create the web hooks and then extract the URLs and put them into the .tfvars-file corresponding to those environments. This works but it would be nicer to be able to look up the existing web hook with a data resource to pass on to the other resource.

jurajmasar commented 8 months ago

Thanks for the suggestion @peter-hippo! Added to our roadmap (no ETA yet, unfortunately)

peter-hippo commented 8 months ago

Thanks @jurajmasar appreciate it!

curusarn commented 3 months ago

Hi @peter-hippo,

Thanks again for raising this! We have added betteruptime_incoming_webhook in #71

Could you give it a try? Please let me know if you run into any issues. 🙏

Thanks again for reaching out.

peter-hippo commented 3 months ago

@jurajmasar / @curusarn I just tested this out and it looks up our incoming web-hooks just great! But it seems the data resource returns the old(?) URL for the incoming web hooks? It uses the betteruptime.com domain and not the uptime.betterstack.com subdomain that can be seen in the configuration of the web hook inside the Web UI? I guess both endpoints will work but I'm curious why it's so, small extract from the terraform plan below:

      ~ endpoint                        = "https://uptime.betterstack.com/api/v1/incoming-webhook/INCOMING-WEBHOOK-ID-HERE" -> "https://betteruptime.com/api/v1/incoming-webhook/INCOMING-WEBHOOK-ID-HERE" # forces replacement

It would normally not be a big deal but we register the URL as a AWS SNS topic receiver (The only supported alerting mechanism from AWS hosted Prometheus) and when changing the URL I need to manually go to the web hook settings and see what the verification URL from AWS is from the payload that AWS sends over.