-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(azure): add diagnostic settings for additional resources (SSPROD…
…-44285) (#56)
- Loading branch information
Showing
7 changed files
with
118 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Azure Additional Resources Module | ||
|
||
This module creates diagnostic settings for all the resources specified by the client and directs the logs for those specified resources to the existing Event Hub, which will be queried by the Sysdig backend for log ingestion. | ||
The resources will forward only the logs specified by the user. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 | | ||
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.76.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | >= 3.76.0 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------| | ||
| [azurerm_monitor_diagnostic_setting.sysdig_custom_diagnostic_settings](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|-------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|:--------:| | ||
| <a name="input_event_hub_name"></a> [event\_hub\_name](#input\_event\_hub\_name) | Event Hub integration created for Sysdig Log Ingestion | `string` | n/a | yes | | ||
| <a name="input_sysdig_authorization_id"></a> [sysdig\_authorization\_id](#input\_sysdig\_authorization\_id) | Identifier of Authorization Rule for the Sysdig Namespace | `string` | n/a | yes | | ||
| <a name="input_deployment_identifier"></a> [deployment\_identifier](#input\_deployment\_identifier) | Identifier of Deployment that gets added to provisioned resources | `string` | n/a | yes | | ||
| <a name="input_diagnostic_settings"></a> [diagnostic\_settings](#input\_diagnostic\_settings) | Map of resource IDs to the list of logs to enable | `map(list(string))` | {} | yes | | ||
## Outputs | ||
|
||
No outputs. | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
|
||
## Authors | ||
|
||
Module is maintained by [Sysdig](https://sysdig.com). | ||
|
||
## License | ||
|
||
Apache 2 Licensed. See LICENSE for full details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# M2 | ||
resource "azurerm_monitor_diagnostic_setting" "sysdig_custom_diagnostic_settings" { | ||
for_each = var.diagnostic_settings | ||
name = "sysdig-diagnostic-settings-${substr(md5(each.key), 0, 8)}-${var.deployment_identifier}" | ||
target_resource_id = each.key | ||
eventhub_authorization_rule_id = var.sysdig_authorization_id | ||
eventhub_name = var.event_hub_name | ||
|
||
dynamic "enabled_log" { | ||
for_each = each.value | ||
content { | ||
category = enabled_log.value | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
variable "sysdig_authorization_id" { | ||
type = string | ||
description = "Identifier of Authorization Rule for the Sysdig Namespace" | ||
} | ||
|
||
variable "event_hub_name" { | ||
type = string | ||
description = "Event Hub integration created for Sysdig Log Ingestion" | ||
} | ||
|
||
variable "diagnostic_settings" { | ||
type = map(list(string)) | ||
description = "Map of resource IDs to the list of logs to enable" | ||
default = {} | ||
} | ||
|
||
variable "deployment_identifier" { | ||
type = string | ||
description = "Identifier of Deployment that gets added to provisioned resources" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0.0" | ||
|
||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">= 3.76.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,4 +184,4 @@ resource "sysdig_secure_cloud_auth_account_component" "azure_event_hub" { | |
} | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters