Skip to content

Conversation

mcnulty-fp
Copy link
Contributor

@mcnulty-fp mcnulty-fp commented Jun 25, 2025

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.

With a Terraform configuration that deployed the CloudFront integration, listing the attached role policies to the IAM role showed no change after running a terraform apply with the updated module. Output was something like:

aws iam list-attached-role-policies --role-name fingerprint-pro-lambda-role-a6a14d03e4de
{
    "AttachedPolicies": [
        {
            "PolicyName": "AWSLambdaBasicExecutionRole",
            "PolicyArn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
        }
    ]
}

@mcnulty-fp mcnulty-fp requested a review from necipallef as a code owner June 25, 2025 20:56
Copy link
Contributor

@necipallef necipallef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's consider using aws_iam_role_policy_attachment instead

@mcnulty-fp mcnulty-fp requested a review from necipallef July 8, 2025 19:39
@mcnulty-fp mcnulty-fp force-pushed the fix/INTER-1311-managed-policy-arns-deprecated branch from 200ea60 to 6c77fbc Compare July 8, 2025 21:30
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_attachment`
resource.

As a result, this commit switches from the `managed_policy_arns`
attribute to a `aws_iam_role_policy_attachment` 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.
@mcnulty-fp mcnulty-fp force-pushed the fix/INTER-1311-managed-policy-arns-deprecated branch from 6c77fbc to 07e97ae Compare July 8, 2025 21:35
Copy link

github-actions bot commented Jul 8, 2025

This PR will create a patch release 🚀

1.1.1 (2025-07-08)

Bug Fixes

  • remove usage of deprecated managed_policy_arns attribute (07e97ae)

@mcnulty-fp mcnulty-fp merged commit 670e72f into rc Jul 9, 2025
4 checks passed
@mcnulty-fp mcnulty-fp deleted the fix/INTER-1311-managed-policy-arns-deprecated branch July 9, 2025 18:01
@fingerprint-dx-team
Copy link

🎉 This PR is included in version 1.1.1-rc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@fingerprint-dx-team
Copy link

🎉 This PR is included in version 1.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants