# iam\_policy update state?

**URL:** <https://forum.ansible.com/t/iam-policy-update-state/19574>\
**Category:** Ansible Developer\
**Created:** [October 21, 2015, 12:30pm UTC](https://forum.ansible.com/t/iam-policy-update-state/19574 "2015-10-21T12:30:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaime\_Bermudez](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@Jaime\_Bermudez](https://forum.ansible.com/u/Jaime_Bermudez)\
**Post date:** [October 21, 2015, 12:30pm UTC](https://forum.ansible.com/t/iam-policy-update-state/19574/1 "2015-10-21T12:30:29Z")

</div>

Hello!

I was so enticed by the iam modules slated for Ansible 2.0 that I decided to download the current devel them into a 1.9.4 project and see if they would work… and they do! At least, for what I’m trying to do which is to create an iam role and then attach a policy to it. What I noticed in experimenting with iam\_policy was that it wouldn’t register a change if I kept the iam\_name the same, but updated the policy\_json. Since I have the module code, I looked into it and the only way to register a change for this scenario is to set skip\_duplicates flag to False. Doing so will always result in an attempted boto update and results in Ansible marking the module as changed regardless of whether the policy document/json itself has changed. I’d like an option for the module to only calliam.put\_role\_policy if the policy document has changed or if the policy doesn’t exist at all. I’m happy to submit a PR but I wanted to get a sense of what the present state for this module should be? If the policy exists, but the contents change then should I add an updated state, or is it reasonable for this be part of the existing present state?

Thanks!

Jaime

---

<div class="post-metadata">

**Author:** ![Jaime\_Bermudez](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@Jaime\_Bermudez](https://forum.ansible.com/u/Jaime_Bermudez)\
**Post date:** [October 25, 2015, 1:32pm UTC](https://forum.ansible.com/t/iam-policy-update-state/19574/2 "2015-10-25T13:32:52Z")

</div>

OK, I submitted a PR where I kept the policy update as part of the present state. Here’s the PR: [https://github.com/ansible/ansible-modules-core/pull/2352](https://github.com/ansible/ansible-modules-core/pull/2352)

Thanks!

Jaime
