Skip to content

Commit

Permalink
fix: prevent lambda IAM policies from detaching when orders are swapped
Browse files Browse the repository at this point in the history
  • Loading branch information
tammyisacoder committed Oct 11, 2024
1 parent 7bd028b commit 53fe2de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ resource "aws_iam_role_policy_attachment" "additional_one" {
######################################

resource "aws_iam_role_policy_attachment" "additional_many" {
count = local.create_role && var.attach_policies ? var.number_of_policies : 0
for_each = { for k, v in toset(var.policies) : k => v if local.create_role && var.attach_policies && var.number_of_policies > 0 }

role = aws_iam_role.lambda[0].name
policy_arn = var.policies[count.index]
policy_arn = each.value
}

###############################
Expand Down

0 comments on commit 53fe2de

Please sign in to comment.