title: Unable to update Service Role in CodeBuild with error "The policy was not attached to role"
body: <p>When I create a brand new CodeBuild project, it allows me to select an IAM Service Role, and when I check the box &quot;Allow AWS CodeBuild to modify this service role so it can be used with this build project&quot;, AWS modifies that Service Role with a custom policy that's specific to this role.</p>
  <p>But If after creating that CodeBuild project I want to attach a different service role to it, I keep getting the below message saying &quot;The policy was not attached ot role [x]&quot;</p>
  <p><a href="https://i.stack.imgur.com/OELvM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OELvM.png" alt="enter image description here" /></a></p>
  <p>I'm pretty sure I'm missing a permission somewhere, but I'm not sure where.</p>
  <p>Edit with more troubleshooting data:</p>
  <ul>
  <li><p>If I uncheck the box &quot;Allow aws [...]&quot; It allows me to update the CodeBuild project configuration, but all subsequent builds fail at startup. This is expected.</p>
  </li>
  <li><p>If I try to re-add the original service role I added to this project when I created it, it lets me add it without any problems.</p>
  </li>
  </ul>