Skip to content

Commit ecba66f

Browse files
committed
roles: use aws_iam_role_policy_attachment
Fixes: Warning: Argument is deprecated with module.aws.aws_iam_role.github_tf, on aws/roles.tf line 82, in resource "aws_iam_role" "github_tf": 82: managed_policy_arns = [ 83: "arn:aws:iam::aws:policy/AdministratorAccess", 84: aws_iam_policy.opentofu_policy.arn 85: ] 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. -- I could have used aws_iam_role_policy_attachments_exclusive but I'm unsure we should make that policy exlcusive for the role. As we do not have that many policies / roles yet, I think we can leave it as-is.
1 parent de5471f commit ecba66f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

aws/roles.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,14 @@ resource "aws_iam_role" "github_tf" {
7979
]
8080
Version = "2012-10-17"
8181
})
82-
managed_policy_arns = [
83-
"arn:aws:iam::aws:policy/AdministratorAccess",
84-
aws_iam_policy.opentofu_policy.arn
85-
]
82+
}
83+
84+
resource "aws_iam_role_policy_attachment" "github_tf_opentofu_policy_attachment" {
85+
role = aws_iam_role.github_tf.name
86+
policy_arn = aws_iam_policy.opentofu_policy.arn
87+
}
88+
89+
resource "aws_iam_role_policy_attachment" "github_tf_administrator_policy_attachment" {
90+
role = aws_iam_role.github_tf.name
91+
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
8692
}

0 commit comments

Comments
 (0)