Terraform – CodeBuild and “Failed to create webhook. GitHub API limit reached”

While recently rebuilding some of CICD platform components I have came across this very much annoying error while trying to use aws_codebuild_project resource.

The error message shown said ….

"OAuthProviderException","message":"Failed to create webhook. GitHub API limit reached. Please try again later.

At first it feels like its pretty obvious error – you have been hammering API ( especially while recreating all resources ) that you have just hit the API requests limit. Easy step – just wait a moment and re-run your terraform build.

However in this case just by simple wait – nothing has changed. Error kept coming back. This made me a little bit to scratch my head so I set TF_LOG into DEBUG to peak what is exactly going on.

And this is where the surprise was coming …. the error reported back from API was different from the actual response! The HTTP response code was HTTP.400 stating very clear that the target repository I am trying to create the webhook for HAS BEEN ARCHIVED and does not allow for modifications in its current state ( which TF obviously been trying to do when creating the webhook)

So thats it! Hope it helps someone to overcome if stumble across that one.


Leave a Reply

Your email address will not be published. Required fields are marked *