diff --git a/google_fastly_waf/main.tf b/google_fastly_waf/main.tf index ff2f26e5..b4ef05db 100644 --- a/google_fastly_waf/main.tf +++ b/google_fastly_waf/main.tf @@ -323,3 +323,12 @@ resource "sigsci_edge_deployment_service_backend" "ngwaf_edge_service_backend_sy sigsci_edge_deployment_service.ngwaf_edge_service_link, ] } + +### Slack Alerting Integration for WAF Events +resource "sigsci_site_integration" "slack_logging_mode_alerts" { + count = var.enable_slack_logging_mode_alerts ? 1 : 0 + site_short_name = sigsci_site.ngwaf_edge_site.short_name + type = "slack" + url = var.slack_logging_webhook_url + events = ["loggingModeChanged"] +} diff --git a/google_fastly_waf/outputs.tf b/google_fastly_waf/outputs.tf index d0f6cfb7..e41f4004 100644 --- a/google_fastly_waf/outputs.tf +++ b/google_fastly_waf/outputs.tf @@ -5,3 +5,7 @@ output "ngwaf_edgesite_short_name" { output "certificate_verification_information" { value = fastly_tls_subscription.fastly.*.managed_dns_challenges } + +output "slack_logging_integration_id" { + value = var.enable_slack_logging_mode_alerts ? sigsci_site_integration.slack_logging_mode_alerts[0].id : null +} diff --git a/google_fastly_waf/variables.tf b/google_fastly_waf/variables.tf index e2af3459..7c119601 100644 --- a/google_fastly_waf/variables.tf +++ b/google_fastly_waf/variables.tf @@ -133,3 +133,15 @@ variable "ngwaf_percent_enabled" { type = number default = 100 } + +variable "slack_logging_webhook_url" { + type = string + sensitive = true + default = "TBD" +} + +variable "enable_slack_logging_mode_alerts" { + description = "Enable or disable the Slack integration for logging mode change alerts" + type = bool + default = true +}