Skip to content
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

[bug] adding scheduled queries iam role path prefix #1216

Merged
merged 1 commit into from
Mar 31, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ resource "aws_cloudwatch_event_rule" "event" {
name = "${var.prefix}_streamalert_scheduled_queries_event_${count.index}"
description = var.query_packs[count.index].description
schedule_expression = var.query_packs[count.index].schedule_expression

tags = {
Name = "StreamAlert"
}
}

resource "aws_cloudwatch_event_target" "run_step_function" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Attach additional permissions to the auto-generated Lambda IAM Role
resource "aws_iam_role_policy" "lambda_permissions" {
name = "${var.prefix}_streamalert_scheduled_queries_lambda_permissions"
name = "LambdaRequiredPermissions"
role = module.scheduled_queries_lambda.role_id
policy = data.aws_iam_policy_document.lambda_permissions.json
}
Expand Down Expand Up @@ -97,7 +97,12 @@ data "aws_iam_policy_document" "lambda_permissions" {
# Setup the IAM Role for the Step Functions
resource "aws_iam_role" "iam_for_step_functions" {
name = "${var.prefix}_streamalert_scheduled_queries_state_machines"
path = "/streamalert/"
assume_role_policy = data.aws_iam_policy_document.iam_step_function_assume_role.json

tags = {
Name = "StreamAlert"
}
}

# Only allow Step Functions to assume this role
Expand All @@ -116,7 +121,7 @@ data "aws_iam_policy_document" "iam_step_function_assume_role" {

# Attach an additional policy to the IAM Role
resource "aws_iam_role_policy" "stepfunction_permissions" {
name = "${var.prefix}_streamalert_scheduled_queries_state_machine_permissions"
name = "StepFunctionsInvokeLambda"
role = aws_iam_role.iam_for_step_functions.id
policy = data.aws_iam_policy_document.stepfunction_permissions.json
}
Expand All @@ -143,7 +148,12 @@ data "aws_iam_policy_document" "stepfunction_permissions" {
# Setup the IAM Role
resource "aws_iam_role" "iam_for_cloudwatch_schedule" {
name = "${var.prefix}_streamalert_scheduled_queries_cloudwatch_schedule"
path = "/streamalert/"
assume_role_policy = data.aws_iam_policy_document.iam_cloudwatch_assume_role.json

tags = {
Name = "StreamAlert"
}
}

# Only allow cloudwatch to assume this role
Expand All @@ -162,7 +172,7 @@ data "aws_iam_policy_document" "iam_cloudwatch_assume_role" {

# Attach additional permissions to the IAM Role
resource "aws_iam_role_policy" "cloudwatch_schedule_permissions" {
name = "${var.prefix}_streamalert_scheduled_queries_cloudwatch_schedule_permissions"
name = "StepFunctionsStartViaCWE"
role = aws_iam_role.iam_for_cloudwatch_schedule.id
policy = data.aws_iam_policy_document.cloudwatch_schedule_permission.json
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ resource "aws_sfn_state_machine" "state_machine" {
}
EOF

tags = {
Name = "StreamAlert"
}

}

This file was deleted.