Skip to content

Commit dbd0930

Browse files
committed
fixed deprecated issue
Warning: Argument is deprecated │ │ with module.sra_execution_role.aws_iam_role.sra_execution_role, │ on sra_execution_role/main.tf line 21, in resource "aws_iam_role" "sra_execution_role": │ 21: managed_policy_arns = [ │ 22: "arn:${var.aws_partition}:iam::aws:policy/AdministratorAccess" │ 23: ] │ │ managed_policy_arns is deprecated. Use the aws_iam_role_policy_attachment resource instead. If Terraform should exclusively manage all managed policy attachments (the current behavior of this argument), use the aws_iam_role_policy_attachments_exclusive resource as well. ╵
1 parent b37ceed commit dbd0930

File tree

1 file changed

+6
-5
lines changed
  • aws_sra_examples/terraform/common/sra_execution_role

1 file changed

+6
-5
lines changed

aws_sra_examples/terraform/common/sra_execution_role/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ resource "aws_iam_role" "sra_execution_role" {
1313
Action = "sts:AssumeRole",
1414
Effect = "Allow",
1515
Principal = {
16-
AWS = "arn:${var.aws_partition}:iam::${var.management_account_id}:root"
16+
AWS = format("arn:%s:iam::%s:root", var.aws_partition, var.management_account_id)
1717
}
1818
}]
1919
})
2020

21-
managed_policy_arns = [
22-
"arn:${var.aws_partition}:iam::aws:policy/AdministratorAccess"
23-
]
24-
2521
tags = {
2622
"sra-solution" = var.solution_name
2723
}
24+
}
25+
26+
resource "aws_iam_role_policy_attachment" "sra_execution_role_admin_policy" {
27+
role = aws_iam_role.sra_execution_role.name
28+
policy_arn = format("arn:%s:iam::aws:policy/AdministratorAccess", var.aws_partition)
2829
}

0 commit comments

Comments
 (0)