|
18 | 18 | Audit Logs - IAM
|
19 | 19 | *****************************************/
|
20 | 20 |
|
21 |
| -locals { |
22 |
| - enabling_data_logs = var.data_access_logs_enabled ? ["DATA_WRITE", "DATA_READ"] : [] |
23 |
| -} |
24 |
| - |
25 |
| -resource "google_organization_iam_audit_config" "org_config" { |
26 |
| - count = local.parent_folder == "" ? 1 : 0 |
27 |
| - org_id = local.org_id |
28 |
| - service = "allServices" |
29 |
| - |
30 |
| - ################################################################################################### |
31 |
| - ### Audit logs can generate costs, to know more about it, |
32 |
| - ### check the official documentation: https://cloud.google.com/stackdriver/pricing#logging-costs |
33 |
| - ### To know more about audit logs, you can find more infos |
34 |
| - ### here https://cloud.google.com/logging/docs/audit/configure-data-access |
35 |
| - ### To enable DATA_READ and DATA_WRITE audit logs, set `data_access_logs_enabled` to true |
36 |
| - ### ADMIN_READ logs are enabled by default. |
37 |
| - #################################################################################################### |
38 |
| - dynamic "audit_log_config" { |
39 |
| - for_each = setunion(local.enabling_data_logs, ["ADMIN_READ"]) |
40 |
| - content { |
41 |
| - log_type = audit_log_config.key |
42 |
| - } |
43 |
| - } |
44 |
| -} |
45 |
| - |
46 |
| -resource "google_folder_iam_audit_config" "folder_config" { |
47 |
| - count = local.parent_folder != "" ? 1 : 0 |
48 |
| - folder = "folders/${local.parent_folder}" |
49 |
| - service = "allServices" |
50 |
| - |
51 |
| - ################################################################################################### |
52 |
| - ### Audit logs can generate costs, to know more about it, |
53 |
| - ### check the official documentation: https://cloud.google.com/stackdriver/pricing#logging-costs |
54 |
| - ### To know more about audit logs, you can find more infos |
55 |
| - ### here https://cloud.google.com/logging/docs/audit/configure-data-access |
56 |
| - ### To enable DATA_READ and DATA_WRITE audit logs, set `data_access_logs_enabled` to true |
57 |
| - ### ADMIN_READ logs are enabled by default. |
58 |
| - #################################################################################################### |
59 |
| - dynamic "audit_log_config" { |
60 |
| - for_each = setunion(local.enabling_data_logs, ["ADMIN_READ"]) |
61 |
| - content { |
62 |
| - log_type = audit_log_config.key |
63 |
| - } |
64 |
| - } |
65 |
| -} |
66 |
| - |
67 | 21 | resource "google_project_iam_member" "audit_log_logging_viewer" {
|
68 | 22 | project = module.org_audit_logs.project_id
|
69 | 23 | role = "roles/logging.viewer"
|
|
0 commit comments