Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Here is an example of using this module:
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br/>This is for some rare cases where resources want additional configuration of tags<br/>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br/>in the order they appear in the list. New attributes are appended to the<br/>end of the list. The elements of the list are joined by the `delimiter`<br/>and treated as a single ID element. | `list(string)` | `[]` | no |
| <a name="input_cloudwatch_event_rule_pattern_detail_type"></a> [cloudwatch\_event\_rule\_pattern\_detail\_type](#input\_cloudwatch\_event\_rule\_pattern\_detail\_type) | The detail-type pattern used to match events that will be sent to SNS. <br/><br/>For more information, see:<br/>https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html | `string` | `"Security Hub Findings - Imported"` | no |
| <a name="input_cloudwatch_event_rule_pattern_detail"></a> [cloudwatch\_event\_rule\_pattern\_detail](#input\_cloudwatch\_event\_rule\_pattern\_detail) | The detail pattern used to match events that will be sent to SNS. <br/><br/>For more information, see:<br/>https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html | `any` | `null` | no |
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br/>See description of individual variables for details.<br/>Leave string and numeric variables as `null` to use default value.<br/>Individual variable settings (non-null) override settings in context object,<br/>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br/> "additional_tag_map": {},<br/> "attributes": [],<br/> "delimiter": null,<br/> "descriptor_formats": {},<br/> "enabled": true,<br/> "environment": null,<br/> "id_length_limit": null,<br/> "label_key_case": null,<br/> "label_order": [],<br/> "label_value_case": null,<br/> "labels_as_tags": [<br/> "unset"<br/> ],<br/> "name": null,<br/> "namespace": null,<br/> "regex_replace_chars": null,<br/> "stage": null,<br/> "tags": {},<br/> "tenant": null<br/>}</pre> | no |
| <a name="input_create_sns_topic"></a> [create\_sns\_topic](#input\_create\_sns\_topic) | Flag to indicate whether an SNS topic should be created for notifications<br/><br/>If you want to send findings to a new SNS topic, set this to true and provide a valid configuration for subscribers | `bool` | `false` | no |
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br/>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
Expand Down
21 changes: 13 additions & 8 deletions eventbridge.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,19 @@ resource "aws_cloudwatch_event_rule" "imported_findings" {
tags = module.this.tags

event_pattern = jsonencode(
{
"source" : [
"aws.securityhub"
],
"detail-type" : [
var.cloudwatch_event_rule_pattern_detail_type
]
}
merge(
{
"source" : [
"aws.securityhub"
],
"detail-type" : [
var.cloudwatch_event_rule_pattern_detail_type
]
},
var.cloudwatch_event_rule_pattern_detail != null ?
{ "detail" : var.cloudwatch_event_rule_pattern_detail } :
{}
)
)
}

Expand Down
3 changes: 2 additions & 1 deletion examples/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ output "enabled_subscriptions" {
}

output "sns_topic" {
value = module.example.sns_topic
description = "The SNS topic that was created"
value = module.example.sns_topic
}
19 changes: 15 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ variable "imported_findings_notification_arn" {
description = <<-DOC
The ARN for an SNS topic to send findings notifications to. This is only used if create_sns_topic is false.

If you want to send findings to an existing SNS topic, set the value of this to the ARN of the existing topic and set
If you want to send findings to an existing SNS topic, set the value of this to the ARN of the existing topic and set
create_sns_topic to false.
DOC
default = null
Expand All @@ -73,6 +73,17 @@ variable "cloudwatch_event_rule_pattern_detail_type" {
default = "Security Hub Findings - Imported"
}

variable "cloudwatch_event_rule_pattern_detail" {
description = <<-DOC
The detail pattern used to match events that will be sent to SNS.

For more information, see:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html
DOC
type = any
default = null
}

variable "finding_aggregator_enabled" {
description = <<-DOC
Flag to indicate whether a finding aggregator should be created
Expand All @@ -89,9 +100,9 @@ variable "finding_aggregator_enabled" {

variable "finding_aggregator_linking_mode" {
description = <<-DOC
Linking mode to use for the finding aggregator.
Linking mode to use for the finding aggregator.

The possible values are:
The possible values are:
- `ALL_REGIONS` - Aggregate from all regions
- `ALL_REGIONS_EXCEPT_SPECIFIED` - Aggregate from all regions except those specified in `var.finding_aggregator_regions`
- `SPECIFIED_REGIONS` - Aggregate from regions specified in `finding_aggregator_enabled`
Expand All @@ -102,7 +113,7 @@ variable "finding_aggregator_linking_mode" {

variable "finding_aggregator_regions" {
description = <<-DOC
A list of regions to aggregate findings from.
A list of regions to aggregate findings from.

This is only used if `finding_aggregator_enabled` is `true`.
DOC
Expand Down