Skip to content

Commit e849be0

Browse files
committed
fix: remove usage of deprecated managed_policy_arns attribute
The `managed_policy_arns` attribute on `aws_iam_role` resources has been deprecated. At the AWS API layer, the `managed_policy_arns` list is translated by Terraform to individual "attached role policy" resources. Per the Terraform docs, using the `managed_policy_arns` attribute is equivalent to using a separate `aws_iam_role_policy_attachments_exclusive` resource. As a result, this commit switches from the `managed_policy_arns` attribute to a `aws_iam_role_policy_attachments_exclusive` resource. After this change, upgrading the fingerprint_cloudfront_integration module and running a terraform apply will result in Terraform creating a new resource in its state, but there will be no corresponding state change in the AWS APIs. Terraform also no longer produces the warning about the argument being deprecated.
1 parent 3d64edf commit e849be0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,15 @@ resource "aws_iam_role_policy" "fpjs_proxy_lambda" {
8686
})
8787
}
8888

89+
resource "aws_iam_role_policy_attachments_exclusive" "fpjs_proxy_lambda" {
90+
role_name = aws_iam_role.fpjs_proxy_lambda.name
91+
policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
92+
}
93+
8994
resource "aws_iam_role" "fpjs_proxy_lambda" {
9095
name = "fingerprint-pro-lambda-role-${local.integration_id}"
9196
permissions_boundary = var.fpjs_proxy_lambda_role_permissions_boundary_arn
9297
assume_role_policy = data.aws_iam_policy_document.assume_role.json
93-
managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
9498
}
9599

96100
data "aws_s3_object" "fpjs_integration_s3_bucket" {

0 commit comments

Comments
 (0)