Creating AWS CodePipeline fails setting up GitHub webhook

I’m trying to set up an AWS CodePipline using the Cloudposse ecs-codepipeline module. The plan step works when I run it on Terraform Cloud, but with this warning:

Warning: The CodePipeline GitHub version 1 action provider is deprecated.

But it allows me to apply, and when I do it fails in the github_repository_webhooks module. I get the following error:

Error: POST 404 Not Found
with module.project_module.module.ecs_codepipeline.module.github_webhooks.github_repository_webhook.default[0]
on .terraform/modules/project_module.ecs_codepipeline.github_webhooks/ line 7, in resource “github_repository_webhook” “default”:

resource "github_repository_webhook" "default" {

I’m not sure if this is related. According to the documentation, the /repos/{owner}/{repo}/hooks URL should exist. But indeed, curl -I returns 404 from my desktop as well.

Please correct me if I’m wrong, but it seems like the failing step is Terraform reaching out to GitHub to create a webhook on behalf of AWS so that CodePipeline will be notified when a new commit is pushed. The docs say that an auth error would result in a 403, so it really does seem like the GitHub URL doesn’t exist.

Can anyone advise if there are any steps I need to take on the GitHub side for the webhook creation URL to be present? I’ve provided a PAT with both repo and admin:repo_hook permissions. Still, it seems like the endpoint is simply missing.

I’ve found this GitHub issue which has a few suggestions for how to resolve the issue. Unfortunately, none of them have worked for me.

I have resolved my issue. It turned out to be a permissions problem in the end: my user wasn’t an Admin on the repo I was trying to add the hook to. You can learn more in the GitHub issue.