-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global Alert Firehose #468
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Stream Alert Globals | ||
* This Terraform module creates various global infrastructure components | ||
|
||
## Components | ||
* Kinesis Firehose Delivery Stream for Putting Alerts on S3 | ||
|
||
## Example | ||
``` | ||
module "globals" { | ||
source = "../modules/tf_stream_alert_globals" | ||
account_id = "112233445566" | ||
region = "us-east-1" | ||
prefix = "mycompany" | ||
} | ||
``` | ||
|
||
## Inputs | ||
<table> | ||
<tr> | ||
<th>Property</th> | ||
<th>Description</th> | ||
<th>Default</th> | ||
<th>Required</th> | ||
</tr> | ||
<tr> | ||
<td>account_id</td> | ||
<td>Your AWS Account ID</td> | ||
<td>None</td> | ||
<td>True</td> | ||
</tr> | ||
<tr> | ||
<td>region</td> | ||
<td>The AWS region for your stream</td> | ||
<td>None</td> | ||
<td>True</td> | ||
</tr> | ||
<tr> | ||
<td>prefix</td> | ||
<td>The resource prefix, normally an organizational name or descriptor</td> | ||
<td>None</td> | ||
<td>True</td> | ||
</tr> | ||
</table> | ||
|
||
## Outputs | ||
<table> | ||
<tr> | ||
<th>Property</th> | ||
<th>Description</th> | ||
</tr> | ||
</table> |
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
20 changes: 20 additions & 0 deletions
20
terraform/modules/tf_stream_alert_globals/alerts_firehose/main.tf
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 @@ | ||
// AWS Firehose Stream for Alerts to S3 | ||
resource "aws_kinesis_firehose_delivery_stream" "stream_alerts" { | ||
name = "${var.prefix}_streamalert_alert_delivery" | ||
destination = "s3" | ||
|
||
s3_configuration { | ||
role_arn = "${aws_iam_role.firehose.arn}" | ||
bucket_arn = "arn:aws:s3:::${var.prefix}.streamalerts" | ||
prefix = "alerts/" | ||
buffer_size = "${var.buffer_size}" | ||
buffer_interval = "${var.buffer_interval}" | ||
compression_format = "${var.compression_format}" | ||
|
||
cloudwatch_logging_options { | ||
enabled = true | ||
log_group_name = "/aws/kinesisfirehose/${var.prefix}_streamalert_alert_delivery" | ||
log_stream_name = "S3Delivery" | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
terraform/modules/tf_stream_alert_globals/alerts_firehose/variables.tf
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,21 @@ | ||
variable "account_id" {} | ||
|
||
variable "buffer_size" { | ||
default = 128 | ||
} | ||
|
||
variable "buffer_interval" { | ||
default = 300 | ||
} | ||
|
||
variable "cloudwatch_log_retention" { | ||
default = 30 | ||
} | ||
|
||
variable "compression_format" { | ||
default = "GZIP" | ||
} | ||
|
||
variable "prefix" {} | ||
|
||
variable "region" {} |
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,6 @@ | ||
module "alerts_firehose" { | ||
source = "alerts_firehose" | ||
account_id = "${var.account_id}" | ||
prefix = "${var.prefix}" | ||
region = "${var.region}" | ||
} |
Empty file.
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,5 @@ | ||
variable "account_id" {} | ||
|
||
variable "prefix" {} | ||
|
||
variable "region" {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to use full arn of firehose delivery stream, instead of
${aws_kinesis_firehose_delivery_stream.stream_alerts.arn}
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That resource isn't in this module, so that interpolation isn't possible. I'd have to pass it in as a variable to this module instead, which I can do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Thanks for the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually going to leave it, since we do the same thing for Athena data streams