Skip to content

Commit

Permalink
Merge pull request #2 from nitrocode/master
Browse files Browse the repository at this point in the history
More changes for aws_iam_role_policy_attachment
  • Loading branch information
rb-nr authored Feb 13, 2020
2 parents 738b82c + dc201a2 commit b344eb9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ resource "aws_iam_policy" "logs" {
policy = data.aws_iam_policy_document.logs[0].json
}

resource "aws_iam_policy_attachment" "logs" {
resource "aws_iam_role_policy_attachment" "logs" {
count = var.cloudwatch_logs ? 1 : 0

name = "${var.function_name}-logs"
roles = [aws_iam_role.lambda.name]
role = aws_iam_role.lambda.name
policy_arn = aws_iam_policy.logs[0].arn
}

Expand Down Expand Up @@ -94,11 +93,10 @@ resource "aws_iam_policy" "dead_letter" {
policy = data.aws_iam_policy_document.dead_letter[0].json
}

resource "aws_iam_policy_attachment" "dead_letter" {
resource "aws_iam_role_policy_attachment" "dead_letter" {
count = var.dead_letter_config == null ? 0 : 1

name = "${var.function_name}-dl"
roles = [aws_iam_role.lambda.name]
role = aws_iam_role.lambda.name
policy_arn = aws_iam_policy.dead_letter[0].arn
}

Expand Down Expand Up @@ -145,10 +143,9 @@ resource "aws_iam_policy" "additional" {
policy = var.policy.json
}

resource "aws_iam_policy_attachment" "additional" {
resource "aws_iam_role_policy_attachment" "additional" {
count = var.policy == null ? 0 : 1

name = var.function_name
roles = [aws_iam_role.lambda.name]
role = aws_iam_role.lambda.name
policy_arn = aws_iam_policy.additional[0].arn
}

0 comments on commit b344eb9

Please sign in to comment.