Skip to content

Commit

Permalink
Fix lambda logging policies
Browse files Browse the repository at this point in the history
  • Loading branch information
gertjanmaas committed May 11, 2020
1 parent 88ac0b3 commit 96545be
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 6 additions & 0 deletions modules/runners/policies-lambda-common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ resource "aws_iam_policy" "lambda_logging" {

policy = templatefile("${path.module}/policies/lambda-cloudwatch.json", {})
}

resource "aws_iam_policy_attachment" "lambda_logging" {
name = "${var.environment}-lambda-logging"
roles = [aws_iam_role.scale_down.name, aws_iam_role.scale_runners_lambda.name]
policy_arn = aws_iam_policy.lambda_logging.arn
}
File renamed without changes.
14 changes: 7 additions & 7 deletions modules/runners/scale-down.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ resource "aws_iam_role" "scale_down" {
assume_role_policy = data.aws_iam_policy_document.lambda_assume_role_policy.json
}

resource "aws_iam_policy_attachment" "scale_scake_down_logging" {
name = "${var.environment}-logging"
roles = [aws_iam_role.scale_down.name]
policy_arn = aws_iam_policy.lambda_logging.arn
}

resource "aws_iam_policy" "scale_down" {
name = "${var.environment}-lamda-scale-down-policy"
name = "${var.environment}-lambda-scale-down-policy"
description = "Lambda scale up policy"
policy = templatefile("${path.module}/policies/lambda-scale-down.json", {})
}

resource "aws_iam_policy_attachment" "scale_down" {
name = "${var.environment}-scale-down"
roles = [aws_iam_role.scale_down.name]
policy_arn = aws_iam_policy.scale_down.arn
}



10 changes: 2 additions & 8 deletions modules/runners/scale-runners-lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,8 @@ resource "aws_iam_role" "scale_runners_lambda" {
assume_role_policy = data.aws_iam_policy_document.lambda_assume_role_policy.json
}

resource "aws_iam_policy_attachment" "scale_runners_lambda_logging" {
name = "${var.environment}-logging"
roles = [aws_iam_role.scale_runners_lambda.name]
policy_arn = aws_iam_policy.lambda_logging.arn
}

resource "aws_iam_policy" "scale_runners_lambda_sqs" {
name = "${var.environment}-lamda-scale-runners-sqs-receive-policy"
name = "${var.environment}-lambda-scale-runners-sqs-receive-policy"
description = "Lambda scale up sqs policy"

policy = templatefile("${path.module}/policies/lambda-scale-runners.json", {
Expand All @@ -63,7 +57,7 @@ resource "aws_iam_policy_attachment" "scale_runners_lambda_sqs" {


resource "aws_iam_policy" "scale_runners_lambda" {
name = "${var.environment}-lamda-scale-up-policy"
name = "${var.environment}-lambda-scale-up-policy"
description = "Lambda scale up policy"

policy = templatefile("${path.module}/policies/lambda-scale-up.json", {
Expand Down

0 comments on commit 96545be

Please sign in to comment.