Policy Attached to 0 entities Error
The Issue
If the github webhook not working and you’re seeing this error:
The policy is attached to 0 entities but it must be attached to a single role
Here’s a screenshot:
The CodeBuild console seems to be confused. Believe the CodeBuild wizard tries to creates an conventional IAM policy and attaches it to the CodeBuild project. Cody creates an IAM role via code and attaches it to the the CodeBuild project though. Hence the confusion.
Now, if you’re webhook is not working for whatever reason. Maybe it’s out of sync on GitHub. Then CloudFormation doesn’t seem to update the webhook.
Workaround
A workaround is to delete both:
- Service role permissions - by unchecking the checkbox
- Primary source webhook events - by unchecking the checkbox
Screenshots provided below:
Then make a slight change to the .cody/project.rb
and run cody deploy
. You can just remove the webhook, deploy, add back the webhook and deploy again. This syncs back up CodeBuild with CloudFormation and the webhook should be fixed.
Resources
- What to do if you get a “The policy is attached to 0 entities but it must be attached to a single role” error in aws - Use google translate to convert from Japanese to English
- Policy is attached to 0 entities
Pro tip: Use the <- and -> arrow keys to move back and forward.
Edit this page
See a typo or an error? You can improve this page. This website is available on GitHub, and contributions are encouraged and welcomed. We love pull requests from you!
- Suggest an edit to this page (here's the contributing guide).
- Open an issue about this page to report a problem.