Open Z4ck404 opened 4 months ago
Voting for Prioritization
Volunteering to Work on This Issue
@Z4ck404 Please provide the before and after Terraform configurations, so it's clear what changes you are making to the managed_policy_arns
argument.
In general, I am not able to reproduce the problem, as adding and removing policies in managed_policy_arns
resulted in the appropriate updates. The update logic in the resource code is quite straightforward in detecting and managing the differences for the managed_policy_arns
argument.
The only case where it could be an issue is to remove or set to null
the managed_policy_arns
when it is previously set in the TF configuration. In that case, per the documentation you should set just managed_policy_arns
to an empty list to remove all attached IAM managed policies anyway.
Hey @acwwat,
The only case where it could be an issue is to remove or set to null the managed_policy_arns when it is previously set in the TF configuration.
That's exactly my case, the policies were previously set when I was doing some testing then removed later (I just removed the whole field and didn't set it to null or []).
I missed the description of the attribute where the behavior is mentioned.
Terraform Core Version
1.3.2
AWS Provider Version
5.57.0
Affected Resource(s)
aws_iam_role
Expected Behavior
When applying updates to the aws_iam_role resource in Terraform, specifically changes to the managed_policy_arns attribute, the expected behavior is that Terraform should detect any modifications to the list of ARNs and apply these changes accordingly to the IAM role in AWS.
When the managed_policy_arns list is updated in the Terraform configuration file, running terraform apply should detect the changes and update the IAM role's attached managed policies to reflect the new configuration.
Actual Behavior
Terraform's apply operation does not detect changes made to the managed_policy_arns attribute. As a result, the IAM role in AWS does not get updated with the new set of managed policy ARNs, leading to a state drift between the Terraform state and the actual IAM role configuration in AWS.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
update the managed_policy_arns and you will get the same plan.
Steps to Reproduce
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None