如何通过Terraforn设置Azure Web应用程序防火墙(WAF)日志?

时间:2020-05-20 10:36:23

标签: azure terraform terraform-provider-azure azure-waf

我正在尝试通过Terraform代码执行此操作: enter image description here

但是,我找不到方法。是一些晦涩的资源还是根本没有实现?

2 个答案:

答案 0 :(得分:1)

您可以按照ydaetskcoR所述,使用azurerm_monitor_diagnostic_setting来配置设置,它的工作原理与您提供的屏幕截图相同。这是示例代码:

resource "azurerm_monitor_diagnostic_setting" "example" {
  name               = "example"
  target_resource_id = "application_gateway_resource_id"
  storage_account_id = data.azurerm_storage_account.example.id

  log {
    category = "ApplicationGatewayFirewallLog"
    enabled  = true

    retention_policy {
      enabled = true
      days = 30
    }
  }

}

Terraform不支持​​应用程序网关的数据,因此您需要自己输入现有应用程序网关的资源ID,或者在创建新的应用程序网关时引用该ID。

答案 1 :(得分:0)

似乎Terraform for Azure WAF(ApplicationGateway)尚不支持日志。