Skip to content

Commit

Permalink
change policy attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jul 29, 2025
1 parent 6e0d65b commit d6b4bfa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rolesanywhere/role.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ resource "aws_iam_role" "role" {
force_detach_policies = local._defaults["force_detach_policies"]
max_session_duration = var.max_session_duration
assume_role_policy = data.aws_iam_policy_document.role_anywhere_assume.json
managed_policy_arns = var.managed_policy_arns

# managed_policy_arns = var.managed_policy_arns

tags = merge(
local.base_tags,
Expand All @@ -38,7 +37,7 @@ resource "aws_iam_role" "role" {
}

resource "aws_iam_role_policy_attachment" "role" {
for_each = toset(var.attached_policies)
for_each = toset(distinct(compact(concat(var.attached_policies, var.managed_policy_arns))))
role = aws_iam_role.role.name
policy_arn = each.value
}
Expand Down

0 comments on commit d6b4bfa

Please sign in to comment.