I am receiving the following error when creating a Github repository webhook as part of CodePipeline.
github_repository_webhook.github_hook: Creating... Error: POST https://api.github.com/repos/myrepoxx/static-web-example/hooks: 404 Not Found []
Tried changing the URL and repository with no success
hooks.tf
resource "aws_codepipeline_webhook" "codepipeline_webhook" {
authentication = "GITHUB_HMAC"
name = "codepipeline-webhook"
target_action = "Source"
target_pipeline = aws_codepipeline.static_web_pipeline.name
authentication_configuration {
secret_token = random_string.github_secret.result
}
filter {
json_path = "$.ref"
match_equals = "refs/heads/{Branch}"
}
tags = {}
}
resource "github_repository_webhook" "github_hook" {
repository = var.repository_name
events = ["push"]
configuration {
url = aws_codepipeline_webhook.codepipeline_webhook.url
insecure_ssl = "0"
content_type = "json"
secret = random_string.github_secret.result
}
}
resource "random_string" "github_secret" {
length = 99
special = false
}
var.tf
variable "env" {
default = "dev"
}
variable "region" {
default = "eu-west-1"
}
variable "repository_branch" {
default = "master"
}
variable "repository_owner" {
default = "myrepoxx"
}
variable "repository_name" {
default = "static-web-example"
}
variable "static_web_bucket_name" {
default = "myrepoxx-static-web-example-bucket"
}
variable "artifacts_bucket_name" {
default = "myrepoxx-static-web-example-artifacts"
}
variable "github_token" {
}
output "web_public_url" {
value = aws_s3_bucket.static_web_bucket.website_endpoint
}