Skip to content

Commit

Permalink
Fix cloudtrail role attachment (#96)
Browse files Browse the repository at this point in the history
* Resource needs to be conditional, only created when `enable_cloudtrail` is set
  • Loading branch information
Stretch96 authored May 20, 2024
1 parent 99bfbde commit 94c6684
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cloudtrail.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ resource "aws_iam_policy" "cloudtrail_cloudwatch_logs" {
}

resource "aws_iam_role_policy_attachment" "cloudtrail_cloudwatch_logs" {
count = local.enable_cloudtrail ? 1 : 0

role = aws_iam_role.cloudtrail_cloudwatch_logs[0].name
policy_arn = aws_iam_policy.cloudtrail_cloudwatch_logs[0].arn
}
Expand Down

0 comments on commit 94c6684

Please sign in to comment.