Description
Choose which Data Access events to log in google_project_iam_audit_config. Google Cloud enables Admin Activity audit logs automatically.
Potential impact
Omitting a log type or exempting a principal can leave its activity out of an investigation.
Remediation
For the target service or allServices, select the required ADMIN_READ, DATA_READ and DATA_WRITE types. Review inherited settings and exempted_members, then remove unnecessary exemptions. Check cost, reader access and retention, and verify that events arrive.
Examples
The first example uses the unsupported INVALID_TYPE. The second records both read types and removes the user exemption. Add DATA_WRITE if you also need write activity.
Before
hcl
resource "google_project_iam_audit_config" "example" {
project = "your-project-id"
service = "allServices"
audit_log_config {
log_type = "INVALID_TYPE"
}
audit_log_config {
log_type = "DATA_READ"
exempted_members = [
"user:joebloggs@example.com"
]
}
}
After
hcl
resource "google_project_iam_audit_config" "example" {
project = "your-project-id"
service = "allServices"
audit_log_config {
log_type = "ADMIN_READ"
}
audit_log_config {
log_type = "DATA_READ"
}
}