Skip to content

Commit f305bfe

Browse files
authored
feat(event-hub): add aad diagnostic settings (SSPROD-38091) (#31)
* add entra logs in main * add variable for entra logs * disable retention policy * remove providers * added sub hash also to entra ds * update readme * default to false for entra * update readme * fix enable entra condition * remove providers added for testing
1 parent 0e2a4ab commit f305bfe

File tree

3 files changed

+156
-3
lines changed

3 files changed

+156
-3
lines changed

modules/services/event-hub-data-source/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ The following resources will be created in each instrumented account:
2020

2121
| Name | Version |
2222
|------|---------|
23-
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 2.45.0 |
24-
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.76.0 |
23+
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 2.47.0 |
24+
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.94.0 |
25+
| <a name="provider_random"></a> [random](#provider\_random) | 3.6.0 |
2526

2627
## Modules
2728

@@ -36,9 +37,16 @@ No modules.
3637
| [azurerm_eventhub_consumer_group.sysdig_consumer_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/eventhub_consumer_group) | resource |
3738
| [azurerm_eventhub_namespace.sysdig_event_hub_namespace](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/eventhub_namespace) | resource |
3839
| [azurerm_eventhub_namespace_authorization_rule.sysdig_rule](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/eventhub_namespace_authorization_rule) | resource |
40+
| [azurerm_monitor_aad_diagnostic_setting.sysdig_entra_diagnostic_setting](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_aad_diagnostic_setting) | resource |
3941
| [azurerm_monitor_diagnostic_setting.sysdig_diagnostic_setting](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting) | resource |
42+
| [azurerm_monitor_diagnostic_setting.sysdig_org_diagnostic_setting](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting) | resource |
4043
| [azurerm_resource_group.sysdig_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
4144
| [azurerm_role_assignment.sysdig_data_receiver](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
45+
| [random_string.random](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |
46+
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source |
47+
| [azurerm_management_group.onboarded_management_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/management_group) | data source |
48+
| [azurerm_management_group.root_management_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/management_group) | data source |
49+
| [azurerm_subscription.onboarded_subscriptions](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |
4250
| [azurerm_subscription.sysdig_subscription](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |
4351

4452
## Inputs
@@ -48,9 +56,13 @@ No modules.
4856
| <a name="input_auto_inflate_enabled"></a> [auto\_inflate\_enabled](#input\_auto\_inflate\_enabled) | Whether or not auto-inflate is enabled for the Event Hub | `bool` | `true` | no |
4957
| <a name="input_consumer_group_name"></a> [consumer\_group\_name](#input\_consumer\_group\_name) | Name of the consumer group to be created | `string` | `"sysdig-consumer-group"` | no |
5058
| <a name="input_diagnostic_settings_name"></a> [diagnostic\_settings\_name](#input\_diagnostic\_settings\_name) | Name of the diagnostic settings to be created | `string` | `"sysdig-diagnostic-settings"` | no |
59+
| <a name="input_enable_entra"></a> [enable\_entra](#input\_enable\_entra) | (Optional) Used to enable or disable Entra logs, defaults to false. | `bool` | `false` | no |
60+
| <a name="input_entra_diagnostic_settings_name"></a> [entra\_diagnostic\_settings\_name](#input\_entra\_diagnostic\_settings\_name) | Name of the Entra diagnostic settings to be created | `string` | `"sysdig-entra-diagnostic-settings"` | no |
5161
| <a name="input_event_hub_name"></a> [event\_hub\_name](#input\_event\_hub\_name) | Name of the Event Hub to be created | `string` | `"sysdig-event-hub"` | no |
52-
| <a name="input_event_hub_namespace_name"></a> [event\_hub\_namespace\_name](#input\_event\_hub\_namespace\_name) | Name of the Event Hub Namespace to be created | `string` | `"sysdig-event-hub-namespace"` | no |
62+
| <a name="input_event_hub_namespace_name"></a> [event\_hub\_namespace\_name](#input\_event\_hub\_namespace\_name) | Name of the Event Hub Namespace to be created | `string` | n/a | yes |
5363
| <a name="input_eventhub_authorization_rule_name"></a> [eventhub\_authorization\_rule\_name](#input\_eventhub\_authorization\_rule\_name) | Name of the authorization rule to be created | `string` | `"sysdig-send-listen-rule"` | no |
64+
| <a name="input_is_organizational"></a> [is\_organizational](#input\_is\_organizational) | (Optional) Set this field to 'true' to deploy secure-for-cloud to an Azure Tenant. | `bool` | `false` | no |
65+
| <a name="input_management_group_ids"></a> [management\_group\_ids](#input\_management\_group\_ids) | (Optional) List of Azure Management Group IDs. secure-for-cloud will be deployed to all the subscriptions under these management groups. | `set(string)` | `[]` | no |
5466
| <a name="input_maximum_throughput_units"></a> [maximum\_throughput\_units](#input\_maximum\_throughput\_units) | The maximum number of throughput units to be allocated to the Event Hub | `number` | `20` | no |
5567
| <a name="input_message_retention_days"></a> [message\_retention\_days](#input\_message\_retention\_days) | Number of days during which messages will be retained in the Event Hub | `number` | `1` | no |
5668
| <a name="input_namespace_sku"></a> [namespace\_sku](#input\_namespace\_sku) | SKU (Plan) for the namespace that will be created | `string` | `"Standard"` | no |

modules/services/event-hub-data-source/main.tf

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,132 @@ resource "azurerm_monitor_diagnostic_setting" "sysdig_diagnostic_setting" {
117117
category = "Policy"
118118
}
119119
}
120+
121+
resource "azurerm_monitor_aad_diagnostic_setting" "sysdig_entra_diagnostic_setting" {
122+
count = var.enable_entra ? 1 : 0
123+
124+
name = "${var.entra_diagnostic_settings_name}-${local.subscription_hash}"
125+
eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.sysdig_rule.id
126+
eventhub_name = azurerm_eventhub.sysdig_event_hub.name
127+
128+
enabled_log {
129+
category = "AuditLogs"
130+
131+
retention_policy {
132+
enabled = false
133+
}
134+
}
135+
136+
enabled_log {
137+
category = "SignInLogs"
138+
139+
retention_policy {
140+
enabled = false
141+
}
142+
}
143+
144+
enabled_log {
145+
category = "NonInteractiveUserSignInLogs"
146+
147+
retention_policy {
148+
enabled = false
149+
}
150+
}
151+
152+
enabled_log {
153+
category = "ServicePrincipalSignInLogs"
154+
155+
retention_policy {
156+
enabled = false
157+
}
158+
}
159+
160+
enabled_log {
161+
category = "ManagedIdentitySignInLogs"
162+
163+
retention_policy {
164+
enabled = false
165+
}
166+
}
167+
168+
enabled_log {
169+
category = "ProvisioningLogs"
170+
171+
retention_policy {
172+
enabled = false
173+
}
174+
}
175+
176+
enabled_log {
177+
category = "ADFSSignInLogs"
178+
179+
retention_policy {
180+
enabled = false
181+
}
182+
}
183+
184+
enabled_log {
185+
category = "RiskyUsers"
186+
187+
retention_policy {
188+
enabled = false
189+
}
190+
}
191+
192+
enabled_log {
193+
category = "UserRiskEvents"
194+
195+
196+
retention_policy {
197+
enabled = false
198+
}
199+
}
200+
201+
enabled_log {
202+
category = "NetworkAccessTrafficLogs"
203+
204+
retention_policy {
205+
enabled = false
206+
}
207+
}
208+
209+
enabled_log {
210+
category = "RiskyServicePrincipals"
211+
212+
retention_policy {
213+
enabled = false
214+
}
215+
}
216+
217+
enabled_log {
218+
category = "ServicePrincipalRiskEvents"
219+
220+
retention_policy {
221+
enabled = false
222+
}
223+
}
224+
225+
enabled_log {
226+
category = "EnrichedOffice365AuditLogs"
227+
228+
retention_policy {
229+
enabled = false
230+
}
231+
}
232+
233+
enabled_log {
234+
category = "MicrosoftGraphActivityLogs"
235+
236+
retention_policy {
237+
enabled = false
238+
}
239+
}
240+
241+
enabled_log {
242+
category = "RemoteNetworkHealthLogs"
243+
244+
retention_policy {
245+
enabled = false
246+
}
247+
}
248+
}

modules/services/event-hub-data-source/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ variable "diagnostic_settings_name" {
8484
default = "sysdig-diagnostic-settings"
8585
}
8686

87+
variable "entra_diagnostic_settings_name" {
88+
type = string
89+
description = "Name of the Entra diagnostic settings to be created"
90+
default = "sysdig-entra-diagnostic-settings"
91+
}
92+
8793
variable "is_organizational" {
8894
description = "(Optional) Set this field to 'true' to deploy secure-for-cloud to an Azure Tenant."
8995
type = bool
@@ -95,3 +101,9 @@ variable "management_group_ids" {
95101
type = set(string)
96102
default = []
97103
}
104+
105+
variable "enable_entra" {
106+
description = "(Optional) Used to enable or disable Entra logs, defaults to false."
107+
type = bool
108+
default = false
109+
}

0 commit comments

Comments
 (0)