diff --git a/modules/services/webhook-datasource/README.md b/modules/services/webhook-datasource/README.md index 3671702..20b9c1b 100644 --- a/modules/services/webhook-datasource/README.md +++ b/modules/services/webhook-datasource/README.md @@ -73,6 +73,7 @@ No modules. | [external\_id](#input\_external\_id) | (Required) Random string generated unique to a customer | `string` | n/a | yes | | [suffix](#input\_suffix) | (Optional) Suffix to uniquely identify resources during multiple installs. If not provided, random value is autogenerated | `string` | `null` | no | | [audit\_log\_config](#input\_audit\_log\_config) | List of services and their audit log configurations to be ingested. Default is to ingest all logs. |
list(object({
service = string,
log_config = list(object({
log_type = string,
exempted_members = optional(list(string))
}))
}))
|
[
{
"log_config": [
{
"log_type": "ADMIN_READ"
},
{
"log_type": "DATA_READ"
},
{
"log_type": "DATA_WRITE"
}
],
"service": "allServices"
}
]
| no | +| [ingestion\_sink\_filter](#input\_ingestion\_sink\_filter) | Filter the Sink is set up with. Ingests AuditLogs by default. | `string` | `protoPayload.@type = "type.googleapis.com/google.cloud.audit.AuditLog"` | no | | [exclude\_logs\_filter](#input\_exclude\_logs\_filter) | Filter to exclude logs from ingestion. Default is to ingest all google.cloud.audit.AuditLog logs. with no exclusions. |
list(object({
name = string,
description = optional(string),
filter = string,
disabled = optional(bool)
}))
| `[]` | no | ## Outputs diff --git a/modules/services/webhook-datasource/main.tf b/modules/services/webhook-datasource/main.tf index 5217a23..b86d4f7 100644 --- a/modules/services/webhook-datasource/main.tf +++ b/modules/services/webhook-datasource/main.tf @@ -83,7 +83,7 @@ resource "google_logging_project_sink" "ingestion_sink" { # NOTE: The target destination is a PubSub topic destination = "pubsub.googleapis.com/projects/${var.project_id}/topics/${google_pubsub_topic.ingestion_topic.name}" - filter = "protoPayload.@type = \"type.googleapis.com/google.cloud.audit.AuditLog\"" + filter = var.ingestion_sink_filter # Dynamic block to exclude logs from ingestion dynamic "exclusions" { diff --git a/modules/services/webhook-datasource/organizational.tf b/modules/services/webhook-datasource/organizational.tf index 5ecfa4c..2f3eb96 100644 --- a/modules/services/webhook-datasource/organizational.tf +++ b/modules/services/webhook-datasource/organizational.tf @@ -39,7 +39,7 @@ resource "google_logging_organization_sink" "ingestion_sink" { # NOTE: The target destination is a PubSub topic destination = "pubsub.googleapis.com/projects/${var.project_id}/topics/${google_pubsub_topic.ingestion_topic.name}" - filter = "protoPayload.@type = \"type.googleapis.com/google.cloud.audit.AuditLog\"" + filter = var.ingestion_sink_filter # Dynamic block to exclude logs from ingestion dynamic "exclusions" { diff --git a/modules/services/webhook-datasource/variables.tf b/modules/services/webhook-datasource/variables.tf index 03c9cdc..d85e1f0 100644 --- a/modules/services/webhook-datasource/variables.tf +++ b/modules/services/webhook-datasource/variables.tf @@ -96,6 +96,12 @@ variable "audit_log_config" { ] } +variable "ingestion_sink_filter" { + type = string + description = "Filter the Sink is set up with. Ingests AuditLogs by default." + default = "protoPayload.@type = \"type.googleapis.com/google.cloud.audit.AuditLog\"" +} + variable "exclude_logs_filter" { description = "Filter to exclude logs from ingestion. Default is to ingest all google.cloud.audit.AuditLog logs. with no exclusions." type = list(object({ diff --git a/test/examples/secure_threat_detection/organization/main.tf b/test/examples/secure_threat_detection/organization/main.tf index 13de1c4..f271277 100644 --- a/test/examples/secure_threat_detection/organization/main.tf +++ b/test/examples/secure_threat_detection/organization/main.tf @@ -10,6 +10,7 @@ module "organization-threat-detection" { is_organizational = true organization_domain = "mytestorg.com" external_id = "external_id" + ingestion_sink_filter = "protoPayload.@type = \"type.googleapis.com/google.cloud.audit.AuditLog\" (protoPayload.methodName!~ \"\\.(get|list)$\" OR protoPayload.serviceName != (\"k8s.io\" and \"storage.googleapis.com\"))" audit_log_config = [ { service = "cloudsql.googleapis.com" diff --git a/test/examples/secure_threat_detection/single/main.tf b/test/examples/secure_threat_detection/single/main.tf index 6b8492e..fb753cc 100644 --- a/test/examples/secure_threat_detection/single/main.tf +++ b/test/examples/secure_threat_detection/single/main.tf @@ -8,6 +8,7 @@ module "single-project-threat-detection" { project_id = "mytestproject" push_endpoint = "test_sysdig_secure_cloudingestion_endpoint" external_id = "external_id" + ingestion_sink_filter = "protoPayload.@type = \"type.googleapis.com/google.cloud.audit.AuditLog\" (protoPayload.methodName!~ \"\\.(get|list)$\" OR protoPayload.serviceName != (\"k8s.io\" and \"storage.googleapis.com\"))" audit_log_config = [ { service = "cloudsql.googleapis.com"