handlers.tf 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. locals {
  2. victorops_team = var.environment == "test" ? "test" : "engineering"
  3. }
  4. resource "sensu_mutator" "mutator_xdr" {
  5. name = "xdr_mutator"
  6. command = "/usr/local/bin/xdr_mutator.py"
  7. }
  8. resource "sensu_handler" "handler_keepalive" {
  9. # No victorops in test at all pl0x
  10. count = var.environment == "test" ? 0 : 1
  11. name = "keepalive"
  12. type = "set"
  13. namespace = "default"
  14. handlers = ["victorops", ]
  15. }
  16. resource "sensu_handler" "handler_victorops" {
  17. name = "victorops"
  18. type = "pipe"
  19. namespace = "default"
  20. handlers = ["victorops", ]
  21. mutator = sensu_mutator.mutator_xdr.id
  22. filters = ["is_incident", "not_silenced", "handler-delay", ]
  23. runtime_assets = ["sensu-plugins-victorops", "sensu-ruby-runtime", ]
  24. command = "handler-victorops.rb --map_go_event_into_ruby -a https://alert.victorops.com/integrations/generic/20131114/alert/864a1b38-4243-4137-8baa-b587ba5f300b/ -r ${local.victorops_team}"
  25. }
  26. resource "sensu_handler" "handler_logfile" {
  27. name = "logfile"
  28. type = "pipe"
  29. namespace = "default"
  30. handlers = []
  31. filters = []
  32. runtime_assets = ["sensu-ruby-runtime", ]
  33. command = "/usr/local/bin/stdin_to_log.py"
  34. }
  35. resource "sensu_handler" "handler_email" {
  36. name = "email-xdr-eng"
  37. type = "pipe"
  38. namespace = "default"
  39. handlers = []
  40. filters = ["is_incident", "not_silenced"]
  41. runtime_assets = ["sensu/sensu-email-handler", ]
  42. command = "sensu-email-handler -f sensu@${local.smtp_secrets["mail_from_domain"]} -t duane.e.waddle@accenturefederal.com -T /etc/sensu/email-template -s ${local.smtp_secrets["mail_host"]} -u ${local.smtp_secrets["mail_user"]} -p '${local.smtp_secrets["mail_password"]}'"
  43. timeout = 10
  44. }